#include
void main()
{
int a,n,rev=0,p;
clrscr();
printf("Enter Value to Reverse the Digits and Find is Palindrome : ");
scanf("%d",&n);
p=n;
while(n!=0)
{
a=n%10;
rev=rev*10+a;
n=n/10;
}
printf("\n\tReverse of %d is %d",p,rev);
if(p==rev)
printf("\n\t%d is Palindrom.",p);
else
printf("\n\t%d is Not a Palindrom.",p);
getch();
}
Output
Enter Value to Reverse the Digits and Find is Palindrome: 535
Reverse of 535 is 535
535 is Palindrome.
No comments:
Post a Comment