C++ gurus and learners, we program ourselves :P all work is CC licensed

Monday, November 18

Reverse any Integer without strings

It seems now are a stronger community to write generalized programs for FAST NU as well :)
I am posting a program below which reverses any number with just 1 while loop.
See if it works :P
PS please if you copy this or get inspired from this post for your blog then mention us in the post that will be a great gesture than just being douche 3:)
//Code by Umar Farooq
/**
 * follow us at http://CppQA.blogspot.com
 * 
**/
#include <iostream>
using namespace std;

int main() {
 int number = 12345678;
 cout<<"Reverse of number "<<number<<" is ";
 while(number)
 {
  cout<<number%10;
  number/=10;
 }
 
 return 0;
}

hi my name is umar