A palindromic number or numeral palindrome is a number that remains the same when its digits are reversed.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, …
#include <stdio.h>
#include <conio.h>
int main()
{
int num, reverse = 0;
int temp;
printf("Enter a number to check if it is a palindrome or not: ");
scanf("%d",&num);
temp = num;
while( temp != 0 )
{
reverse = reverse * 10;
reverse = reverse + temp%10;
temp = temp/10;
}
if ( num == reverse )
printf("Number %d is a palindrome.\n", num);
else
printf("Number %d is not a palindrome.\n", num);
getch();
}
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, …
#include <stdio.h>
#include <conio.h>
int main()
{
int num, reverse = 0;
int temp;
printf("Enter a number to check if it is a palindrome or not: ");
scanf("%d",&num);
temp = num;
while( temp != 0 )
{
reverse = reverse * 10;
reverse = reverse + temp%10;
temp = temp/10;
}
if ( num == reverse )
printf("Number %d is a palindrome.\n", num);
else
printf("Number %d is not a palindrome.\n", num);
getch();
}