/****************************************************
Program to check whether the number is a palindrome
****************************************************/
#include<stdio.h> // include stdio.h library
int main(void)
{
int num, tmp_num, rev = 0, rem;
printf("Enter a number: \n");
scanf("%d", &num);
tmp_num = num;
while(tmp_num != 0)
{
rem = tmp_num % 10; // get the last digit from tmp_num
rev = rev * 10 + rem;
tmp_num /= 10; // remove the last digit from tmp_num
}
if(num == rev)
{
printf("%d is a palindrome number.", num);
}
else
{
printf("%d is not palindrome number.", num);
}
return 0; // return 0 to operating system
}