57. C Program To check a Number is Palindrome number or Not.
How does this program work?
- This Program is used to check the given number is palindrome number or not.
Here is the code
#include <stdio.h>
int main(void)
{
int n, n1 = 0, r, a;
printf("Enter an integer: ");
scanf("%d", &n);
a = n;
// Reversed integer is stored in variable
while( n!=0 )
{
r = n%10;
n1 = n1*10 + r;
n /= 10;
}
// Palindrome if orignalInteger and reversedInteger are equal
if (a == n1)
printf("%d is a palindrome.", a);
else
printf("%d is not a palindrome.", a);
return 0;
}