Skip to content

Instantly share code, notes, and snippets.

@mariiaKolokolova
Created May 3, 2020 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariiaKolokolova/00311b198e169e146e879ff1c9286ece to your computer and use it in GitHub Desktop.
Save mariiaKolokolova/00311b198e169e146e879ff1c9286ece to your computer and use it in GitHub Desktop.
package maricka.kolokolova;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int n = 0;
Scanner sc = new Scanner(System.in);
System.out.println("Input length of array:");
n = sc.nextInt();
int[] mass = new int[n];
for (int i = 0; i < n; i++) {
System.out.println("Input " + i + " elements:");
mass[i] = sc.nextInt();
}
System.out.println("Your array is : " + Arrays.toString(mass));
sc.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment