#include<iostream> using namespace std; int main() { int n, num,digit,rev=0; cout<<"enter a positive number:"; cin>>num; n=num; while(num) { digit=num%10; rev=(rev*10)+digit; num=num/10; } cout<<"the reverse of the number is:"<<rev<<endl; if(n==rev) cout<<"the number is palindrome"; else cout<<"the number is not a palindrome"; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter