-
Notifications
You must be signed in to change notification settings - Fork 1
/
greet.java
28 lines (25 loc) · 899 Bytes
/
greet.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
//this program prints Namaste, Hello, Bonjour using if/else and switch cases
import java.util.*;
public class greet {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int press = scanner.nextInt();
//if(press == 1){
//System.out.println("Namaste");
//}else if(press == 2){
//System.out.println("Hello");
//}else if(press ==3){
//System.out.println("Bonjour");
//}
switch(press){
case 1: System.out.println("Namaste");
break;
case 2: System.out.println("Hello");
break;
case 3: System.out.println("Bonjour");
break;
default: System.out.println("No Result");
break;
}
}
}