Tue Nov 05 2019
Palindrome Number
C++ Programming1152 views
File Name: palindrome-number.cpp
#include<iostream>
using namespace std;
int main() {
int no, temp, palindrome = 0;
cout << "Check the given number is Palindrome or not" << endl;
cout << "Enter a Number:" << endl;
cin >> no;
temp = no;
/* Loop the process using "While loop" */
while(temp != 0) {
palindrome = palindrome * 10;
palindrome = palindrome + (temp % 10);
temp = temp / 10;
}
if(no == palindrome)
cout << "It's a Palindrome Number!" << endl;
else
cout << "It's not a Palindrome Number!" << endl;
return 0;
}
/* Output */
Check the given number is Palindrome or not
Enter a number:
121
It's a Palindrome Number!
/* ---------------------------------- */
Check the given number is Palindrome or not
Enter a number:
128
It's not a Palindrome Number!
Reference:
Author:Geekboots