This program takes an integer from user and the
integer is reversed. If the reversed integer is equal to the integer entered by
user then that number is a palindrome. If not that number is not a palindrome.
#include <stdio.h>
int main() {
int num,
temp, remainder, reverse = 0;
printf("Enter an integer: ");
scanf("%d", &num);
/* original
number is stored at temp */
temp =
num;
while
(num > 0)
{
remainder = num % 10;
reverse = reverse * 10 + remainder;
num
/= 10;
}
printf("\nGiven number: %d \n", temp);
printf("\nIts reverse: %d\n", reverse);
if (temp
== reverse)
printf("\n\nSo %d is a palindrome. \n");
else
printf("\n\nSo %d is not a palindrome. \n");
}