A palindromic number (also known as a numeral palindrome or a numeric palindrome) is a number that remains the same when its digits are reversed. Like 16461, for example, it is "symmetrical". The term palindromic is derived from palindrome, which refers to a word (such as rotor or racecar) 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, …
PROGRAM:
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int n,n1,r,r1=0;
- clrscr();
- printf("enter a number");
- scanf("%d",&n);
- n=n1;
- while(n>0)
- {
- r=n%10;
- r1=r1*10+r;
- n/=10;
- }
- if(n1==r1)
- {
- printf("number is palindrome");
- }
- else
- {
- printf("number is not palindrome");
- }
- getch();
- }
output:
n=151
number is palindrome
n=151
number is palindrome