-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray1.java
More file actions
40 lines (23 loc) · 808 Bytes
/
Copy pathArray1.java
File metadata and controls
40 lines (23 loc) · 808 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
// take an array as input from user , search for a given no. "x" and print the index at which it occurs.
//
import java.util.Scanner;
public class Array1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("enter the size of array: ");
int size = sc.nextInt();
int numbers[] = new int[size];
// input array elements
for(int i=0; i<size; i++)
{
System.out.println("enter"+ size + "elemmts in the array : ");
numbers[i] = sc.nextInt();
}
// output
for(int i=0; i<size; i++)
{
System.out.println(numbers[i]);
}
System.out.println("Enter the no. which you want to find in the array: ");
}
}