#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
bool isPalindrome(int x) {
long long revnum = 0;
int dup = x;
while(x>0){
int ld = x % 10;
revnum = (revnum * 10) + ld;
x = x/10;
}
if ( dup==revnum) {
return true;
} else {
return false;
}
return dup == revnum;
}
};
int main () {
Solution obj;
int number;
cin>>number;
if(obj.isPalindrome(number)){
cout << number << " is a palindrome." << endl;
} else {
cout << number << " is not a palindrome." << endl;
}
return 0;
};
To embed this project on your website, copy the following code and paste it into your website's HTML: