5 Ints Using Arrays Result code example
Example: Echo5Ints Using Arrays Result
import java.util.Scanner;
public class ArrayInputOutput {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Please enter 5 integers: ");
int[] arr = new int[5];
for(int i = 0; i < arr.length; ++i) {
arr[i] = in.nextInt();
}
System.out.print("The 5 integers = ");
for(int i = 0; i < arr.length; ++i) {
System.out.print(arr[i] + " ");
}
System.out.println();
}
}