C Program to Check the Number is Palindrome or Not

Write a C Program to check whether the number is palindrome or not ?

What is Palindrome number?
A palindrome is a number that remains the same when its digits are reversed.For example – 1551,121,32423, etc, if these digits are reversed then also we get the same result.The term palindromic is derived from palindrome, which refers to a word (such as rotor or racecar) whose spelling is unchanged when its letters are reversed.
This program reverses an integer (entered by the user) using while loop. Then, if statement is used to check whether the reversed number is equal to the original number or not.

C Programming code for Palindrome number or not:

int integer( int n )
int rem,rev=0,a;
while( n!=0 )
if ( a == rev)
printf(“%d is a palindrome”,a);
printf(“%d is a not palindrome”,a);
int main()
int num,a;
printf(“enter the num”);
integer( num );
return 0;

Logic behind this program to check number is palindrome or not:

1. Input a number from user. Store it in some variable.
2. Find reverse of the given number. Store it in some variable say reverse.
3. Compare it with the number entered by the user.
4. If both are the same then print palindrome number else print not a palindrome number.

Leave a comment for any queries or question.Stay connected with us for more C programming Language.