title: "WAP a program to find prime numbers between between zero and 100"
body: <p>I typed this piece of code for finding all the prime numbers between 0 and 100, but it gives output with multiples of other numbers. How can I rectify this?</p>
  
  <pre><code>public class PrimeNumbers {
  
      public static void main(String[] args) {
          int count = 0;
          int n = 0;
          for (n = 2; count &lt;= 100; n++) {
  
              for (int j = 2; j &lt; n; j++) {
  
                  while (n % j == 0) {
  
                      j = 2;
  
                      n++;
                  }
              }
              count++;
              System.out.println(n);
          }
      }
  }
  </code></pre>