A palindromic number or numeral palindrome is a number that remains the same when its digits are reversed. Like 16461, for example, it is "symmetrical". The termpalindromic is derived from palindrome, which refers to a word (such as rotor or "racecar" or even "Malayalam") whose spelling is unchanged when its letters are reversed. The first 30 palindromic numbers (in decimal) are:
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, 202, … (sequence A002113 in OEIS).
#include<stdio.h>
#include<conio.h>
void main()
{
int num,rev=0,rem,temp;
printf("Enter a number:");
scanf("%d",&num);
temp=num;
while(num>0)
{
rem=num%10;
rev=rev*10+rem;
num=num/10;
}
if(rev==temp)
printf("%d is palindrome number",temp);
else
printf("%d is not palindrome number",temp);
getch();
No comments:
Post a Comment