In this article, you will learn a C++ program to check palindrome numbers. The concept of palindrome numbers is very straightforward. The number becomes palindrome if it’s reverse as same as the original number.
If we have a number 121. After reverse, it becomes 121. It is the same as the previous number so we can say that the given number is a palindrome number.
Example: Check palindrome number in C++
#include <iostream>
using namespace std;
int main()
{
int number,r,sum=0,temp;
cout<<"Enter Any Number: ";
cin>>number;
temp=number;
while(number>0)
{
r=number%10;
sum=(sum*10)+r;
number=number/10;
}
if(temp==sum)
cout<<"Given number is a Palindrome!";
else
cout<<"Given number is not a Palindrome!";
return 0;
}