Write a Java program to print the even numbers from 1 to 20
Write a Java program to print the even 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:

2
4
6
8
10
12
14
16
18
20

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

Programs