title: c++ for loop converted to a while loop
body: <p>Hi I wrote this code to print out factors of an integer with a for looop</p>
  
  <p>how do i write it with a while loop?</p>
  
  <pre><code>for(int i = 1; i &lt;  integer+1; i++)
  {
      if(integer % i == 0)
          cout&lt;&lt; i&lt;&lt;" ";
  }
  </code></pre>