# C++ Program to Check Palindrome Number

Palindrome Number in C++ | Here we will develop a palindrome number program in C++. The palindrome number is based on Reverse of a number in C++. We will also find the palindrome number in the given range.

Palindrome number:- If the Reverse of a number is equal to the same number then the number is called palindrome number. Example:-
5225 = 5225 So, 5225 is a palindrome number.
123 = 321 So, 123 is not a palindrome number.

``````// C++ program to check palindrome Number
#include< iostream>
using namespace std;
int main()
{
// declare variable
int number, temp, remainder, reverse=0;

// take input
cout << "Enter Number : ";
cin >> number;

/* assign number to a temp variable
* because at last, we have to
* compare final result with
* original number
**/
temp=number;

// loop to repeat the process
while (number != 0)
{
remainder = number % 10;
reverse = (reverse * 10) + remainder;
number /= 10;
}

// display result
if (reverse == temp)
cout << reverse << " is Palindrome Number." << endl;
else
cout << reverse << " is NOT a Palindrome Number." << endl;

return 0;
}``````

Output:-

Enter Number: 121
121 is Palindrome Number.

Enter Number: 1234
4321 is NOT a Palindrome Number.

## C++ Program to Find Palindrome Number in a Give Range

Here we will write a C++ program to find palindrome number in a given range. To do this, you can use while loop or do-while loop or for loop.

``````// C++ program to find palindrome Number in a give range
#include<iostream>
using namespace std;
int main()
{
// declare variable
int m, n;
int number, temp, remainder, reverse;

// take input
cout << "Enter min Range : ";
cin >> m;
cout << "Enter max Range : ";
cin >> n;

cout << "Palindrome Numbers are: " << endl;

for (int i=m; i<=n; i++)
{
number = i;
reverse = 0;
while (number != 0)
{
remainder = number % 10;
reverse = (reverse * 10) + remainder;
number /= 10;
}

if (reverse == i)
cout << i << " ";
}

return 0;
}``````

Output:-

Enter min Range: 1
Enter max Range: 100
Palindrome Numbers are:
1 2 3 4 5 6 7 8 9 11 22 33 44 55 66 77 88 99

Enter min Range: 100
Enter max Range: 200
Palindrome Numbers are:
101 111 121 131 141 151 161 171 181 191

If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or you find anything incorrect? Let us know in the comments. Thank you!