Untitled
unknown
plain_text
a year ago
853 B
5
Indexable
Never
// Create a Scanner object to read input from the user Scanner scanner = new Scanner(System.in); // Ask the user to enter the number of integers they want to input System.out.print("Enter the number of integers: "); int numberOfIntegers = scanner.nextInt(); // Create an array to store the integers int[] integers = new int[numberOfIntegers]; // Ask the user to enter the integers System.out.println("Enter " + numberOfIntegers + " integers:"); for (int i = 0; i < numberOfIntegers; i++) { integers[i] = scanner.nextInt(); } // Print the entered integers System.out.println("Entered integers:"); for (int num : integers) { System.out.print(num + " "); }