NBA - Boston Celtics

Tuesday, 4 September 2012

Find the no. is palindrome or not???


#include<iostream.h>
#include<conio.h>
void main()
{
int digit,rev=0,num,i,n;
cout<<"enter any number.. ";
cin>>num;
n=num;
do
{
digit=num%10;
rev=(rev*10)+digit;
num=num/10;
}while(num!=0);
cout<<"your number is "<<n;
cout<<"\nreverse of this number is "<<rev;
if(n==rev)
{
cout<<"\nthe number is palindrome";
}
else
{
cout<<"\nthe number is not a palindrome";
}

}

No comments:

Post a Comment