# Check Palindrome Number

Check Palindrome Number” is very basic and important programming exercise problem. Here, we are given an integer, entered by user and our task is to write a program to check whether an entered number is palindromic number or not.

A palindromic number is a number which is when reversed stays the same number.

Examples of Palindromic Number are 22, 212, 33433 etc.

The steps required to check palindrome number are as follows:

1. Scan a number from a user and copy that number to temporary variable.
2. Initialize a reverse_number with 0.
3. Now, one by one fetch out the last digit from a number using modulus operator and concatenate to reverse_number.
4. Now, check whether reversed_number and temporary variable number are same or not.
5. If they are same, then given number is palindromic number. Else, given number is not palindromic number.

#### C++ Program to check palindrome number is as follows:

```/* C++ Program to check palindrome number */
#include<bits/stdc++.h>
using namespace std;
int main()
{
//Scan the number
int num;
cout<<"Enter the number:";
cin>>num;

// Reverse the number
int temp = num;
int reverse = 0;
while(temp > 0)
{
int digit = temp % 10;
reverse = reverse*10 + digit;
temp = temp/10;
}

// Check Palindrome number
if(num == reverse)
cout<<num<<" is Palindromic Number";
else
cout<<num<<" is not Palindromic Number";
}
```
```OUTPUT:
Enter the number:7117
7117 is Palindromic Number```

Related Posts: