# Palindrome Number program in C++

In this Basic C++ Program, we will have a look at how to write a C++ program to check the palindrome number.

A palindrome number is a number that is the same after reversing. For example, 121, 34543, 343, 131, 48984 are the palindrome numbers.

## Algorithm Of Palindrome Number

• Get the user number
• Keep the number in the temporary variable
• Reverse the number
• Compare the temporary number with the number invested
• If both numbers are the same, print the palindrome number.
• Otherwise, the palindrome number is not printed

Let’s have a look at the palindrome program in C ++. In this program, we will obtain a user input and we will check if the number is a palindrome or not.

## C++ Program To Check The Palindrome Number.

```#include <iostream>

using namespace std;

int main()

{

int n,r,sum=0,temp;

cin>>n;

temp=n;

while(n>0)

{

r=n%10;

sum=(sum*10)+r;

n=n/10;

}

if(temp==sum)

cout<<"Number is Palindrome.";

else

cout<<"Number is not Palindrome.";

return 0;

}  ```

Output: