Welcome..!!

Please visit http://csprograms.in/ for more Computer Science programs.

Tuesday 13 March 2012

8. C++ program to find the given number is palindrome or not.

#include <iostream>
int main()
{
int n,m,p,q;
cout <<"Enter the number\n";
cin >>n;
cout << "Entered number is \n"<<n;
m=n;
p=0;
do
{
q=n%10;
n=n/10;
p=p*10+q;
} while(n!=0);
if(p==m)
cout <<"The given number is palindrome \n"<<m;
else
cout <<"The given number is not palindrome \n"<<m;
return 0;
}

No comments:

Post a Comment