C++ Program to Check Palindrome Number

This program will tell you whether a given number is palindrome or not. Example: If a given number is 121 then it is said to be palindrome because we get the same either we read it from right or left.

#include
#include
void main()
{
int n,r=0,temp;
clrscr();
cout<<"Enter a number:";
cin>>n;
temp=n;
while(temp>0)
{
r=r*10;
r=r+temp%n;
temp=temp/10;
}
if(n==r)
{
cout<<"nNumber is palindrome.";
}
else
{
cout<<"nNumber is not palindrome.";
}
getch();
}

Output:
Enter a number:343
Number is palindrome.

Add Comment