Code to reverse a number:
#include
using namespace std;
int main() {
int n,count,i;
int mul = 1,rev = 0;
cin>>n;
int a = n;
while(a!=0)
{
a=a/10;
count++;
}
while(n!=0)
{
for(i=0;i<count-1;i++)
{
mul = mul*10;
}
rev = (n%10)*mul + rev;
mul = 1;
count–;
n=n/10;
}
cout<<rev<<endl;
return 0;
}