C++ Program to Check Whether a Number is Palindrome Number or not

In this program, you'll learn to check a given number is Palindrome number or not.

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

To check if a number is palindrome or not follow below steps:

1) Declare two variables: one stores the given number, and the other stores the reversed number.

2) Run the while loop until the number is greater than zero.

3) Check if the reversed number is equal to the given number.

Source Code
using namespace std;

int main()
    int num, original, rev=0, digit, i;

    cout<<"Enter the number: ";

    original = num;
    i = 1;
    while(num > 0)
        digit = num%10;
        rev = rev*10 + digit;
        num = num/10;
    if(original == rev)
        cout<<"Number is palindrome";
        cout<<"Number is not palindrome";
    return 0;
Enter the number: 123
Number is not palindrome

Enter the number: 12321
Number is palindrome