NBA - Boston Celtics

Monday, 22 October 2012

palindrome


#include<iostream.h>
#include<conio.h>
void main()
{
int digit,rev=0,num,a;
cout<<"enter a no. : ";
cin>>a;
num=a;
do
{
digit=num%10;
rev=(rev*10)+digit;
num=num/10;
}while(num!=0);
cout<<"reversed no. is"<<rev;
if(a==rev)
cout<<"\n"<<a<<" is a plaindrome \n";
else
cout<<"\n"<<a<<" is not a palindrome";
}

No comments:

Post a Comment