-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHackerrankJava0027.java
33 lines (24 loc) · 1.12 KB
/
HackerrankJava0027.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
import java.util.Scanner;
public class HackerrankJava0027 {
public static void main(String[] args) {
// Java 1D Array
// https://www.hackerrank.com/challenges/java-1d-array-introduction/problem?isFullScreen=true
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
// -------------------------------------------------------------------------------------------------
// --- You need to add this lines for solution hackerrank provides all other lines for challange ---
// -------------------------------------------------------------------------------------------------
Integer[] a = new Integer[n];
for (int i = 0; i < n; i++) {
a[i] = scan.nextInt();
}
// -------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------
scan.close();
// Prints each sequential element in array a
for (int i = 0; i < a.length; i++) {
System.out.println(a[i]);
}
}
}