#include<stdio.h>
#include<conio.h>
main(){
int n,i,rev=0,q,r;
clrscr();
printf("Enter an integer number\n");
scanf("%d",&n);
if (n>0){
q=n;
while (q!=0){
r=q%10;
q=q/10;
rev=rev*10+r;
}
if (n==rev) printf("%d is a palindrom.\n",n);
else printf("%d is not a palindrom.\n",n);
}
else printf("Wrong input\n");
getch();
return 1;
}
No comments:
Post a Comment