-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathswitchCondition.java
More file actions
35 lines (30 loc) · 859 Bytes
/
switchCondition.java
File metadata and controls
35 lines (30 loc) · 859 Bytes
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
package src;
import java.util.Scanner;
public class switchCondition {
public static void main(String[] args) {
var input = new Scanner(System.in);
System.out.print("Enter any number : ");
int number = input.nextInt();
input.close();
switch (number) {
case 1:
System.out.println("One");
break;
case 2:
System.out.println("Two");
break;
case 3:
System.out.println("Three");
break;
case 4:
System.out.println("Four");
break;
case 5:
System.out.println("Five");
break;
default:
System.out.println("Other than one to five.");
break;
}
}
}