biryu2205 / Biryu

0 stars 0 forks source link

Hackerrank Java 1D Array #87

Closed biryu2205 closed 6 years ago

biryu2205 commented 7 years ago
import java.util.Scanner;

public class Solution {

  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();

    int a[] = new int[n];
    for (int i = 0; i < n; i++) {
      int val = scan.nextInt();
      a[i] = val;
    }
    scan.close();

    for (int i = 0; i < a.length; i++) {
      System.out.println(a[i]);
    }
  }
}

link - https://www.hackerrank.com/challenges/java-1d-array-introduction/problem