Here you will get a C++ program to check whether a number is a palindrome or not.
A number is a palindrome if it is equal to its reverse. For example, 121 is a palindrome because if we reverse the order of digits then the number so obtained is equal to the original number.
#include<iostream>
using namespace std;
int main()
{
unsigned long n,num,d,rev=0;
cout<<"Enter any number: ";
cin>>n;
num=n;
do
{
d=n%10;
rev=(rev*10)+d;
n=n/10;
}while(n!=0);
if(num==rev)
cout<<endl<<"Number is Palindrome";
else
cout<<endl<<"Number is not Palindrome";
return 0;
}
Output:
Enter a number: 12321
Number is Palindrome
ha this works
hmm alwayz am gettin not a palindrome ..dunno y.
plz clarify.
C++ program to find whether a no. Is palindrome or not using functions..