/* Palindrome Number : A palindrome number is a number that is same after reverse. */
#include <stdio.h>
int main()
{
int num, temp, rev = 0;
printf("Enter a number you want to check palindrome or not: ");
scanf("%d", &num);
temp = num;
while(num > 0){
rev = rev*10 + num%10;
num = num/10;
}
printf("Number is %d.\n", temp);
printf("Reverse of number is %d.\n", rev);
if(rev == temp)
printf("%d is a palindrome number.", temp);
else
printf("%d is not a palindrome number.", temp);
return 0;
}
Comments
Post a Comment