Write a program to find a number is palindrome or not?
Write a program to find a number is palindrome or not?
#include<stdio.h>
void main()
{
int n,rem,rev=0,num;
printf("Enter a number: ");
scanf("%d",&n);
num=n;
while(n>0)
{
rem=n%10;
rev=rev*10+rem;
n=n/10;
}
if(num==rev)
printf("The number is palindrome");
else
printf("The number is not palindrome");
}
Comments
Post a Comment