Progam : Palindrome Number or Not
#include<stdio.h>
int main()
{
int a, rev = 0, t;
// get the input from the user
printf("Enter a number to check if it is a palindrome or not:\n");
scanf("%d",&a);
// store value of a in t
t = a;
while( t != 0 )
{
// main logic
rev = rev * 10;
rev = rev + t%10;
t = t/10;
}
// check a is equal to rev
if ( a == rev )
printf("%d is a palindrome number.", a);
else
printf("%d is not a palindrome number.", a);
return 0;
}
output: Enter a number to check if it is a palindrome or not:121
121 is a palindrome number:
