title: How to print prime numbers?
body: <p>I am a beginner to java.And i am trying to print 2,3,5,7,11,13,17,19</p>
  
  <p>This is my thought process.the above numbers i want to print are prime numbers which means they can only be divided by themselves or the value 1.So i will need to have a condition which is if(i%i==0 || %1==0){</p>
  
  <pre><code>import java.util.*;
  public class PrimePrinter{
      public static void main(String[] args){
          Scanner sc=new Scanner(System.in);
          System.out.print("Enter num&gt; ");
          int input=sc.nextInt();
  
          for(int i=2;i&lt;=19;i++){
              if(i%i==0&amp;&amp;i%1==0){
                  System.out.print(i);
              }else {
                  System.out.print(",");
              }
          }
      }
  }
  </code></pre>
  
  <p>I try to think through my codes but i wonder why it will print out 2,3,4,5...and up till 19 when i already have a condition.I will appreciate if someone will give me hints for me to work out instead of posting the solutions.</p>