-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDowhile.java
More file actions
42 lines (29 loc) · 927 Bytes
/
Copy pathDowhile.java
File metadata and controls
42 lines (29 loc) · 927 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
36
37
38
39
40
41
42
package Mypack;
import java.util.Scanner;
public class Dowhile {
public static void main(String[] args) {
// TODO Auto-generated method stub
int num;
String ch;
do {
System.out.println(" 1.India\n2.Srilanka\n3.australia\n4.nepal");
Scanner sc = new Scanner(System.in);
System.out.println("enter a choice: ");
num = sc.nextInt();
switch(num) {
case 1: System.out.println("capital of india is : Delhi");
break;
case 2: System.out.println("capital of srilanka is : colambo");
break;
case 3: System.out.println("capital of australia : cenbera");
break;
case 4: System.out.println("captal of nepal: kathmandu");
break;
default:
System.out.println("please enter a valid a input");
}
System.out.println("do you want to continut yes/no");
ch = sc.next();
}while(ch.equals("yes"));
}
}