Excellent Code
simply excellent ...
Pages
Home
Request for more
C++ : a program to reverse a number
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int n,rev=0;
cout<<"Enter any number : ";
cin>>n;
while(n!=0)
{
int r=n%10;
rev=rev*10+r;
n=n/10;
}
cout<<"\n\nReversed number is : "<<rev;
getch();
return(0);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment