C++ Program to find Palindrome numbers

ad+1

Program

// Program By http://solutionscpp.blogspot.com
// Author Mansoor Ahmed
// GMail ID: secguy000@gmail.com

#include <iostream>
using namespace std;

int main()
{
   int num=0, rev = 0, temp=0;

   cout<<"Enter a number: ";
   cin>>num;

   temp = num;

   while( temp != 0 )
   {
      rev = rev * 10;
      rev = rev + temp%10;
      temp = temp/10;
   }

   if ( num == rev )
     cout<<"Number is a palindrome number" <<endl;
   else
      cout<<"Number is not a palindrome number" <<endl;

   return 0;
}

Output:

1 comment: Leave Your Comments