How to Check Palindrome Number or Not
Here you will get the source code of C++ program to check palindrome number or not.
Palindrome number are those number, which can be read same as from backward.
for example:-
12321, 12521, 131, 24542
Example of C++ Program to Check Palindrome Number or Not
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <iostream> using namespace std; int main() { int num,temp,r,k=0; cout<<"\nEnter a number: "; cin>>num; temp=num; while(temp!=0) { r=temp%10; temp=temp/10; k=k*10+r; } if (k==num) cout<<num <<" is a palindrome"; else cout<<num<<" is not a palindrome"; return 0; } |
Output 1
Enter a number: 1234321
1234321 is a palindrome
Output 2
Enter a number: 123542
123542 is not a palindrome
Check out our other C++ programming Examples