Reverse Number Program in C++
This code is very simple and easy to write Reverse Number Program in C++
#include<iostream>
using namespace std;
int main()
{
int n,t,r,rev=0;
cout<<"Enter any number:";
cin>>n;
t=n;
while(t>0)
{
r=t%10;
t=t/10;
rev=rev*10+r;
}
cout<<"Reverse of number"<<n<<"is"<<rev;
return 0;
}
Output
Enter any number:3425
Reverse of number 3425 is 5243
No comments:
Post a Comment