#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int num;
cout<<"Enter a number\n";
cin>>num;
int n = num;
int rev = 0;
while( n >= 1 )
{
int rem = n%10;
rev = (rev*10) + rem;
n=n/10;
}
cout<<"The reverse of given number is:"<<rev<<endl;
if(num==rev)
cout<<"The given number and its reverse are equal" << endl;
else
cout<<"The given number and its reverse are not equal" << endl;
getch();
}
5
solved this C++ code always gives same output