#include
#include
void main()
{
long int n, num, rev = 0, dig;
printf("\n Enter a number...: ");
scanf("%ld", &num);
n = num;
while(num>0)
{
dig = num % 10;
rev = rev * 10 + dig;
num = num / 10;
}
if (n == rev)
printf("\nGiven number is a palindrome");
else
printf("\n Given number not a palindrome");
getch();
}
#include
void main()
{
long int n, num, rev = 0, dig;
printf("\n Enter a number...: ");
scanf("%ld", &num);
n = num;
while(num>0)
{
dig = num % 10;
rev = rev * 10 + dig;
num = num / 10;
}
if (n == rev)
printf("\nGiven number is a palindrome");
else
printf("\n Given number not a palindrome");
getch();
}
No comments:
Post a Comment