-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinputarray.java
More file actions
34 lines (31 loc) · 997 Bytes
/
inputarray.java
File metadata and controls
34 lines (31 loc) · 997 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
import java.util.Scanner;
public class inputarray {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[][][]arr={
{
{1,2,3},
{4,5,6}
},
{
{7,8,9},
{10,11,12}
},
};
System.out.println("Enter number to Search:");
int searchvalue= sc.nextInt();
boolean found = false;
for(int i=0; i<arr.length;i++){
for(int j=0;j<arr[i].length;j++){
for(int k=0;k<arr[i][j].length;k++){
if(arr[i][j][k]==searchvalue){
System.out.println("value"+searchvalue+"found at position["+i+"["+j+"]["+k+"]");
found =true;
}
}
}
}
}if(!found){
System.out.println("value"+searchvalue+"not found in the array");
}
}