Write a program to find the reverse of the entered number

//This is a program to find the reverse of the entered number
#include<iostream>
#include<conio.h>

using namespace std;

int main()
{
int rev=0,rem=0,num;

//Accepting the number

cout<<"\n\nEnter the number: ";
cin>>num;

//Finding the reverse

while(num>0)
{
rem=num%10;
rev=(rev*10)+rem;
num=num/10;
}

//Displaying the Reverse

cout<<"\n\nThe reverse of the entered number is "<<rev;

return 0;
}

Previous
Next Post »