Basic Important Programs
1)Write a Program to check whether the number is prime (or) not ?
Input : 2
Output : The 2 is a prime number
Prime numbers are whole numbers greater than 1 and the number itself.
-----------------------------------------------------------------------------------------------------------------------
2)Write a Program to check whether the number is Palindrome (or) not ?
Input : 121
Ouput : It is a Palindrome
A Palindrome is a number which reads the same backward as forward
----------------------------------------------------------------------------------------------------------------------
3)Write a Program to Reverse a number ?
Input : 123
Ouptut : 321
----------------------------------------------------------------------------------------------------------------------
4)Write a Program to find out the sum of digits of a given number ?
Input : 123
Output : 6
-------------------------------------------------------------------------------------------------------------------------
5)Write a Program to check the number is Armstrong Number (or) not ?
Input : 153
Output : It is a Armstrong Number
Armstrong Number is a number that is equal to sum of cubes of its digits.
------------------------------------------------------------------------------------------------------------------
6)Write a Program to check the number is Strong Number (or) not ?
Input : 145
Output : It is a Strong Number
Strong Number is a Special Number whose sum of factorial of digits is equal to the
original number.
------------------------------------------------------------------------------------------------------------------------
7)Write a Program to Reverse a String ?
Input : raju
Output : ujar
-----------------------------------------------------------------------------------------------------------------------
8)Write a Program to check given string is Palindrome (or) not ?
Input : madam
Output : It is a Palindrome
-------------------------------------------------------------------------------------------------------------
9)Write a Program for Fibonacci Series ?
Input : 2
Output : 0 1
A series of numbers in which each number is the sum of the two preceding numbers
----------------------------------------------------------------------------------------------------------------
10)Write a Program to print Perfect Number below 500 ?
Output : 6,28,496
Perfect Number ,a Positive integer that is equal to the sum of its proper divisors.
-------------------------------------------------------------------------------------------------------------------------
11)Write a Program to implement atoi() function ?
Input : -123@4
Output : -123
atoi converts string to integer.
int atoi(const char *str);
------------------------------------------------------------------------------------------------------------------------
12)Write a Program to implement atof() function ?
Input : -23.75#4
Output : -23.750000
atof converts string to float
float atof(const char *str);
-------------------------------------------------------------------------------------------------------
1)Write a Program to check whether the number is prime (or) not ?
Input : 2
Output : The 2 is a prime number
Prime numbers are whole numbers greater than 1 and the number itself.
-----------------------------------------------------------------------------------------------------------------------
2)Write a Program to check whether the number is Palindrome (or) not ?
Input : 121
Ouput : It is a Palindrome
A Palindrome is a number which reads the same backward as forward
----------------------------------------------------------------------------------------------------------------------
3)Write a Program to Reverse a number ?
Input : 123
Ouptut : 321
----------------------------------------------------------------------------------------------------------------------
4)Write a Program to find out the sum of digits of a given number ?
Input : 123
Output : 6
-------------------------------------------------------------------------------------------------------------------------
5)Write a Program to check the number is Armstrong Number (or) not ?
Input : 153
Output : It is a Armstrong Number
Armstrong Number is a number that is equal to sum of cubes of its digits.
------------------------------------------------------------------------------------------------------------------
6)Write a Program to check the number is Strong Number (or) not ?
Input : 145
Output : It is a Strong Number
Strong Number is a Special Number whose sum of factorial of digits is equal to the
original number.
------------------------------------------------------------------------------------------------------------------------
7)Write a Program to Reverse a String ?
Input : raju
Output : ujar
-----------------------------------------------------------------------------------------------------------------------
8)Write a Program to check given string is Palindrome (or) not ?
Input : madam
Output : It is a Palindrome
-------------------------------------------------------------------------------------------------------------
9)Write a Program for Fibonacci Series ?
Input : 2
Output : 0 1
A series of numbers in which each number is the sum of the two preceding numbers
----------------------------------------------------------------------------------------------------------------
10)Write a Program to print Perfect Number below 500 ?
Output : 6,28,496
Perfect Number ,a Positive integer that is equal to the sum of its proper divisors.
-------------------------------------------------------------------------------------------------------------------------
11)Write a Program to implement atoi() function ?
Input : -123@4
Output : -123
atoi converts string to integer.
int atoi(const char *str);
------------------------------------------------------------------------------------------------------------------------
12)Write a Program to implement atof() function ?
Input : -23.75#4
Output : -23.750000
atof converts string to float
float atof(const char *str);
-------------------------------------------------------------------------------------------------------
0 Comments