-
Notifications
You must be signed in to change notification settings - Fork 0
/
switch_case.java
50 lines (43 loc) · 1.33 KB
/
switch_case.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//write a java program print total number of days in a month using switch case.
import java.util.*;
public class switch_case {
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
System.out.println("number of days");
String n=sc.nextLine();
switch (n){
case "january":
System.out.println("31");
break;
case "march":
System.out.println("28");
break;
case "april":
System.out.println("30");
break;
case "may":
System.out.println("31");
break;
case "june":
System.out.println("30");
break;
case"july":
System.out.println("31");
break;
case "august":
System.out.println("31");
break;
case "september":
System.out.println(30);
break;
case "october":
System.out.println(31);
case "november":
System.out.println(30);
break;
case "december":
System.out.println(31);
break;
}
}
}