>Write a Java program to print the odd numbers from 1 to 20
Write a Java program to print the odd numbers from 1 to 20

Program

public class Demo {
 
  public static void main(String[] args){
	  int x;
      for(x=1;x<=20;x++)
      {
    	  if(x%2!=0)
    	  {
    		  System.out.println(x);
    	  }
      }
    }
}

Output:

1
3
5
7
9
11
13
15
17
19

For latest job updates join Telegram Channel: https://t.me/sateeshm

Programs