by irfanmasiullah » Tue Apr 13, 2010 9:16 am
Hello friend
find below my program for same function in C++, please comment on it, advice me also.
specially I would like comments from Mr. Praveen.
/* This is a program to reverse any number (digit is not limitation) reverse numbers */
/* n= Given number
r= reverse output
d=constant
*/
#include <iostream>
#include <cmath>
int main ()
{
using namespace std;
int r=0,d,n;
cout << "Enter a value:";
cin >> n;
do
{
d=n%10;
n= n/10;
r=r*10+d;
}
while(n!=0);
{
cout << r << "\n" ;
system ("pause");
return 0;
}
}