Friday , December 15 2017
Home / C++ / Palindrome Number program in C++

Palindrome Number program in C++

(Last Updated On: October 8, 2017)

Def : The number   that remain  same after reverse. For example 424, 64546, 343, 818are the palindrome numbers.

Steps to find Palindrome Number  in C++ :

  • Get Number from user
  • Save number in temporary variable
  • Reverse the whole  number
  • Compare the Stored and new reversed number
  • If result is true then both are same numbers

 

Code Help:

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.   int a,b,sum=0,temp;
  6.   cout<<“Enter the Numbers:”;
  7.   cin>>a;
  8.  temp=a;
  9.  while(a>0)
  10. {
  11.  b=a%10;
  12.  sum=(sum*10)+r;
  13.  a=a/10;
  14. }
  15. if(temp==sum)
  16. cout<<“Number is Palindrome.”;
  17. else
  18. cout<<“Number is not Palindrome.”;
  19.   return 0;
  20. }

 

About Admin

Leave a Reply

Your email address will not be published. Required fields are marked *