Answers for "5 Ints Using Arrays Result"

0

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();
    }

}
Posted by: Guest on November-27-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language