/ Flow_Control / switch_case.java
switch_case.java
1 import java.util.Scanner; 2 3 public class switch_case { 4 public static void main(String[] args) { 5 Scanner sc = new Scanner(System.in); 6 7 System.out.println("Enter the number to check : "); 8 int a = sc.nextInt(); 9 10 switch (a % 2) { 11 case 0: 12 System.out.println(a + " is Even"); 13 break; 14 15 case 1: 16 System.out.println(a + " is Odd"); 17 break; 18 19 default: 20 System.out.println("Invalid value"); 21 break; 22 } 23 } 24 }