Algorithm:
- Get the number from keyboard.
- Reverse it.
- Compare it with the number entered by the user.
- If both are the same then print palindrome number else print not a palindrome number.
#include
#include
void main()
{
int n, reverse = 0, t;
clrscr();
printf("Enter a number to check if it is a palindrome or not\n");
scanf("%d", &n);
t = n;
while (t != 0)
{
reverse = reverse * 10;
reverse = reverse + t%10;
t = t/10;
}
if (n == reverse)
printf("%d is a palindrome number.\n", n);
else
printf("%d isn't a palindrome number.\n", n);
getch();
}