Answer:
#include <iostream>
using namespace std;
int main()
{
int num,a,digit;
a=0;
cout<<"Enter the number"<<endl;
cin>>num;
while(num>0)
{
digit=num%10;
a=a*10+digit;
num/=10;
}
cout<<"Reversed number is "<<a<<endl;
return 0;
}
Step-by-step explanation:
Taking input of an integer num.
Initializing an integer a with value 0.
looping over n while it is greater than zero.
By using modulus operator(%) we will get the last digit.
Storing the digit in a.
Dividing num by 10;
After the loop is over we will get the answer in a.