-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathone_dimensional_dowhile.java
More file actions
54 lines (51 loc) · 2.08 KB
/
Copy pathone_dimensional_dowhile.java
File metadata and controls
54 lines (51 loc) · 2.08 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
package array;
import java.util.Scanner;
public class one_dimensional_dowhile {
public static void main(String[] args) {
int [] a = new int[100];
String st;
Scanner objin = new Scanner(System.in);
int n=0,op,i;
do {
System.out.println("1. Input \n");
System.out.println("2. Ouput \n");
System.out.println("3. Search\n");
System.out.print("Please Choose One Option :");
op=objin.nextInt();
switch (op) {
case 1 -> {
System.out.print("Input N:");
n=objin.nextInt();
for(i=0;i<n;i++){
System.out.print("Input Array :");
a[i]=objin.nextInt();
}
}
case 2 -> {
for(i=0;i<n;i++){
System.out.print(a[i]);
}
}
case 3 -> {
int svalue;
int b=0;
System.out.print("Input Value to Search :");
svalue=objin.nextInt();
for(i=0;i<n;i++){
if(a[i]==svalue){
System.out.println(a[i]);
System.out.println("Search found");
b=1;
break;
}
}
if(b==0){
System.out.println("Search not found");
}
}
}
System.out.println("Press yes To Continue ..!");
st=objin.next();
} while (st.equals("yes"));
}
}