-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitchMonth.java
More file actions
56 lines (51 loc) · 1.39 KB
/
Copy pathSwitchMonth.java
File metadata and controls
56 lines (51 loc) · 1.39 KB
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
51
52
53
54
55
56
package Interns_CoreJavaAssignments_V001;
import java.util.*;
public class SwitchMonth {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.println("Enter the month number(1 to 12): ");
int n=sc.nextInt();
switch(n){
case 1:
System.out.println("The month is January");
break;
case 2:
System.out.println("The month is February");
break;
case 3:
System.out.println("The month is March");
break;
case 4:
System.out.println("The month is April");
break;
case 5:
System.out.println("The month is May");
break;
case 6:
System.out.println("The month is June");
break;
case 7:
System.out.println("The month is July");
break;
case 8:
System.out.println("The month is August");
break;
case 9:
System.out.println("The month is Septmber");
break;
case 10:
System.out.println("The month is October");
break;
case 11:
System.out.println("The month is November");
break;
case 12:
System.out.println("The month is December");
break;
default:
System.out.println("Invalid month number. Please enter a number between 1 and 12.");
break;
}
}
}