/* to read a number and decide if its palandrome */
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,rev=0,x,num;
printf("Enter number: ");
scanf("%d",&n);
num=n;
while(n!=0)
{
x=n%10;
rev=rev*10+x;
n/=10;
}
if (rev==num)
printf("%d is palandrome",num);
else
printf("%d is not palandrome",num);
system("pause");
return 0;
}
No comments:
Post a Comment