6. Check if the given number is palindrome or not.
#include <stdio.h>
#include <conio.h>
void main()
{
int num, rem, sum = 0, temp;
clrscr();
printf("Enter the number:");
scanf("%d", &num);
temp = num;
while (num != 0)
{
rem = num % 10;
sum = sum * 10 + rem;
num = num / 10;
}
if (temp == sum)
printf("\nIt is a parlindrom number");
else
printf("\nit is not a parlindrom number");
}
Output
Enter the number:145541
It is a parlindrom number