- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathJava1DArray.java
More file actions
Latest commit
20 lines (16 loc) · 549 Bytes
/
Copy pathJava1DArray.java
File metadata and controls
20 lines (16 loc) · 549 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// https://www.hackerrank.com/challenges/java-1d-array-introduction/problem
importjava.util.Scanner;
publicclassJava1DArray {
publicstaticvoidmain(String[] args) {
Scannerscan = newScanner(System.in);
intn = scan.nextInt();
int[] a = newint[n];
for (intindex = 0 ; index < a.length ; index++) {
a[index] = scan.nextInt();
}
// Prints each sequential element in array a
for (inti = 0; i < a.length; i++) {
System.out.println(a[i]);
}
}
}