title: Determine Prime Numbers using SINGLE do-while Loop
body: <p>I wrote this program per my professor's instruction. Turns out he wanted us to use a SINGLE do-while loop. While I did <em>technically</em> do that... this won't fly. I can't figure out how to do it without using a for-loop or at least another loop of some other type. He said it could use <code>continue</code> or <code>break</code> statements--but that it might not be necessary. </p>
  
  <p>I would appreciate not just re-writing my code--while this is handy, I don't learn from it well.</p>
  
  <p>I appreciate any and all help.</p>
  
  <pre><code>int main() {
  
  int max, x, n = 2; //init variables
  //start n at 2 because 1 isn't prime ever
  
  //asks user for max value
  printf("Enter max number: ");
  scanf("%i", &amp;max);
  
  /*prints prime numbers while the max value
  is greater than the number being checked*/
  do {
      x = 0; //using x as a flag
      for (int i = 2; i &lt;= (n / 2); i++) {
          if ((n % i) == 0) {
              x = 1;
              break;
          }
      }
      if (x == 0) //if n is prime, print it!
          printf("%i\n", n);
      n++; //increase number to check for prime-ness
  } while (n &lt; max);
  
  return 0;
  }
  </code></pre>