Thursday 28 June 2012

c++ program that check whether enter number is palindrome or not

#include<iostream.h>
#include<conio.h>
int main()
{
int rem,nu,n,rev=0;
clrscr();
cout<<"Enter any number : ";



cin>>nu;
n=nu;
while(nu!=0)
{
    rem=nu%10;
    rev=(rev*10)+rem;
    nu=nu/10;
}
if(rev==n)
    cout<<"\n"<<n<<" is a Palindrom number.";
else
    cout<<"\n"<<n<<" is not a Palindrom number.";

getch();
return 0;
}

No comments:

Post a Comment