//Code:
#include
#include
void main()
{
long int a,s=0,n,p;
clrscr();
printf("\n Enter a number : ");
scanf("%ld",&n);
p=n;
do
{
a=p%10;
s=s*10+a;
p=p/10;
}
while(p!=0);
printf("\n The reverse no. is = %ld",s);
if(n==s)
printf("\n The reverse no. is a palindrom");
else
printf("\n The reverse no. is not a palindrom");
getch();
}
/*Output:
Enter a number : 12345
The reverse no. is = 54321
The reverse no. is not a palindrom
Enter a number : 1221
The reverse no. is = 1221
The reverse no. is a palindrom
No comments:
Post a Comment