title: Understanding this nested for loop to display prime numbers in C++
body: <p>I am a beginner in coding, so I am confused about the following sample code to display prime numbers less than 20. </p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main () {
  int i, j;
  
  for(i = 2; i&lt;20; i++) 
  {
    for(j = 2; j &lt;= (i/j); j++)
       if(i%j==0) break; 
       if(j &gt; (i/j)) cout &lt;&lt; i &lt;&lt; " is prime\n";
  
  }
  return 0;
  }
  </code></pre>
  
  <p>So let's say for the first looping, i = 2, I first choose have j = 2. Then, in line 8, I have if(i%j == 0) break; i = j = 2 does satisfy this condition. So why does my output still have 2 as one of the prime numbers? </p>
  
  <p>P.S. I do know 2 is a prime number, but I am not understanding the code. Thank you. </p>