title: Base representation of numbers - output is in reverse order
body: <p>I m trying to represent a positive integer in base(Each base is in
  the range 2 through 16) Its working but the output that I m getting is reverse of the required output for example the binary representation of '2' should be 10 but i m getting '01'. This is my code</p>
  
  <pre><code>#include&lt;iostream.h&gt;
  #include&lt;conio.h&gt;
  #include&lt;math.h&gt;
  
  int main(void)
  {
      int b, number, i, result;
      cout &lt;&lt; "Enter the the number "&lt;&lt; endl;
      cin &gt;&gt; number;
  
      if (number &lt; 0)
      {
          cout &lt;&lt; "Number is not valid, as it must be greater than or equal to 0 \n";
          system("PAUSE");
          return 0;
      }
  
      cout&lt;&lt;"Enter the base value"&lt;&lt; endl;
      cin &gt;&gt; b; 
  
  
      if(b &lt; 2 || b &gt; 16){
          cout &lt;&lt; "Base is not valid.\n";
          system("PAUSE");
          return 0;    
      }
  
      cout &lt;&lt; "The representation of the number with base " &lt;&lt; b &lt;&lt; " is" &lt;&lt; endl;  
  
      while(number &gt; 0)  //number in base 10
      {
          result = number%b; 
          number = number/b;
          i++;                    
  
          if (result == 10)
          {
              cout &lt;&lt; "A";
          }
          if (result == 11)
          {
              cout&lt;&lt;"B";
          }
          else if (result == 12)
          {
              cout&lt;&lt; 'C';
          }
          else if( result == 13)
          {
              cout&lt;&lt;"D";
          }
          else if (result == 14)
          {
              cout &lt;&lt; "E";
          }
          else if(result == 15)
          {
              cout &lt;&lt; "F";
          }
          else {
              cout &lt;&lt; result ;
          }
  
      }
  
      getch();
  }
  </code></pre>
  
  <p>I would appreciate some suggestions.
  Thanks</p>