- Input number from user, 'num'.
- Apply Logic on 'num', produce reversed number 'rev'.
- If num == rev, print 'num' is Palindrome.
- Otherwise print 'num' is not Palindrome.
C Program To Check Whether A Number Is Palindrome Or Not:
/* Double-Click To Select Code */
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d;
clrscr();
printf("Enter a number: ");
scanf("%d",&a);
b=a;
d=0;
while(a!=0)
{
d = d*10;
c = a%10;
a = a/10;
d = d+c;
}
if(d==b)
printf("\nThe number %d is plaindrome",b);
else
printf("\nThe number %d is not Palindrome",b);
getch();
}
Do you like this post? Please link back to this article by copying one of the codes below.
URL: HTML link code: Forum link code:
