Program to reverse an integer number.
#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 the number is :"<<rev<<endl;
cout<<"/*\nName-Sanjampreet Singh\nRoll Number-1507967\n*/";
}
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 the number is :"<<rev<<endl;
cout<<"/*\nName-Sanjampreet Singh\nRoll Number-1507967\n*/";
}
Comments
Post a Comment