/* A palindrome number is a number that is same after reverse. For example 545, 151, 34543, 343, 171, 48984 are the palindrome numbers. */
#include <iostream>
using namespace std;
int main()
{
int N,r=0,d,Num;
cout<<"Enter a Number to check whether it is Palindrome or not\n";
cin>>N;
Num=N;
while(N>0)
{
d=N%10;
r=r*10+d;
N=N/10;
}
if(r==Num)
cout<<Num<<" is a Palindrome Number";
else
cout<<Num<<" is not a Palindrome Number";
}
No comments:
Post a Comment