#include <stdio.h>
#include <stdlib.h>
/*
A palindromic number is a number (such as 16461) that remains the same when its digits are reversed.
*/
int isPalindrome(int num)
{
int reversed = 0;
int originalNumber = num;
while (num != 0)
{
reversed = reversed * 10 + num % 10;
num = num / 10;
}
printf("\nThe reversed number is %d\n", reversed);
if (originalNumber == reversed)
{
return 1;
}
else
{
return 0;
}
}
int main()
{
int number;
printf("Enter a number to check whether it is a palindrome or not: ");
scanf("%d", &number);
if (isPalindrome(number))
{
printf("This number is a palindrome\n");
}
else
{
printf("This number is not a palindrome\n");
}
return 0;
}