WAP to check whether a given no. is palindrome or Not.

#include<iostream.h>
#include<conio.h>
void main()
{    int n,num,digit,rev=0;
      cout<<"\n Input the no.(max.3000)";
      cin>>num;
      n=num;
      do
      {
               digit=num%10;
                rev=(rev*10)+digit;
                num=num/10;
       }     while(num!=0)
        cout<<"The reverse of no. is:"<<rev<<"\n";
        if(n==rev)
              cout<<"The no. is palindrome";
         else
               cout<<"\n The no. is not palindrome";
           getch();
  }        

Comments

Popular Posts