title: convert a number from base-10 to another base
body: <p>I tried the following code to convert a number from base-10 to another base. it works if there is no zero(0) in the destination base. check 79 and 3 and it properly prints 2221 which is correct.
  now try number 19 and 3, the result would be 21 instead of 201 which indicates something's wrong.</p>
  
  <pre><code>int x, y, a = 0, i, t, j;
  cout &lt;&lt; "enter two numbers" &lt;&lt; endl;
  cin &gt;&gt; x &gt;&gt; y; // x as the number in base-10 and x, as the destination base
  a = x;
  while (x &gt;= y)
  {
      t = 1;
      for (i = 0; x &gt; y; i++)
      {
          x /= y;
      }
      cout &lt;&lt; x;
      for (j = 0; j &lt; i; j++)
      {
          t *= y;
      }
      a = a - (t*x);
      x = a;
  }
  cout &lt;&lt; x&lt;&lt;endl;
  </code></pre>