title: How many times a while loop get executed?
body: <p>Yesterday I applied for computer engineering master degree and it was the one of the their questions. I could not solve it so I was very curious.</p>
  
  <pre><code>...
  i = 1;
  while (i &lt;= n)
  {
      i = i * 2;
  }
  ...
  </code></pre>
  
  <p>How many times will this while loop get executed, please give your answer as a formula. For ex: log n...</p>
  
  <p>Thanks</p>