If the original value and its reversed value is same then it will called palindrome value.
#include <iostream>
using namespace std;
int main()
{
int n, num, digit, rev = 0;
cout << "Enter a positive integer number: ";
cin >> num;
n = num;
do
{
digit = num % 10;
rev = (rev * 10) + digit;
num = num / 10;
} while (num != 0);
cout << " The reverse of the number is: " << rev << endl;
if (n == rev)
cout << " The number is a palindrome.";
else
cout << " The number is not a palindrome.";
return 0;
}
OutPut
Enter a positive integer number: 12321 The reverse of the number is: 12321 The number is a palindrome. Enter a positive integer number: 31122000 The reverse of the number is: 00022113 The number is not a palindrome.