CODE:
#include<iostream>
using namespace std;
int main()
{
int n,num,digit,rev=0;
cout<<"ENTER A POSITIVE NUMBER: ";
cin>>num;
n=num;
do{
digit=num%10;
rev=(rev*10)+digit;
num=num/10;
}while(num!=0);
cout<<"THE REVERSE OF NUMBER IS: "<<rev<<endl;
if(n==rev)
{cout<<"THIS NUMBER IS PALINDROME ";}
else
cout<<"THIS NUMBER IS NOT A PALINDROME";
return 0; }
Comments
Post a Comment