title: Why does this simple java program for primes doesn't count 1
body: <pre><code>public class HelloWorld {
      public static void main(String []args) {
          int c = 0;
          int i,j;
          for(i = 1; i &lt;= 20; i++) {
              for(j = 1; j &lt;= i; j++) {
                  if(i % j == 0) {
                      c = c+1;
                  }
              }
  
              if(c == 2) { 
                  System.out.println("the prime number is: "+i);
              }
              c = 0;
           }
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/TFyZP.jpg" rel="nofollow noreferrer">java program to find primes below an integer</a></p>
  
  <p>Also, if I change <code>c==3</code> then the output that it shows is that the primes are 4 and 9. Why is it so?</p>