-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray1.java
41 lines (30 loc) · 908 Bytes
/
array1.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
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.util.*;
public class array1 {
public static void main(String[] args) {
// int marks[]=new int[3];
// marks[0]=1;
// marks[1]=2;
// marks[2]=3;
// for(int i=0;i<3;i++){
// System.out.println(marks[i]);
// }
Scanner sc=new Scanner(System.in);
int size=sc.nextInt();
int numbers[]=new int [size];
//input
for(int i=0;i<size;i++){
numbers[i]=sc.nextInt();
}
int x=sc.nextInt();
for(int i=0;i<numbers.length;i++){
if (numbers[i]==x){
System.out.println("x found at index number :"+i);
}
}
//output printing
//int numbers[]=new int[size];
// for(int i=0;i<size;i++){
// System.out.println(numbers[i]);
// }
}
}