-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathARRAY1.java
More file actions
30 lines (23 loc) · 747 Bytes
/
ARRAY1.java
File metadata and controls
30 lines (23 loc) · 747 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
import java.util.Scanner;
public class ARRAY1 {
public static void printArr(int arr[]) {
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}
}
public static void main(String[] args) {
//ARRAYS
Scanner sc = new Scanner(System.in);
System.out.print("ENTER THE LENGTH OF YOUR ARRAY: ");
int n = sc.nextInt();
int marks[] = new int[n];
for (int i = 0; i < marks.length; i++) {
System.out.print("Enter the entry " + (i + 1) + " : ");
marks[i] = sc.nextInt();
}
System.out.println("YOUR ARRAY IS:");
System.out.print("{ ");
printArr(marks);
System.out.print(" }");
}
}