004-001-009

Arrays: Integer Array Declaration and Initialization

Easy

Problem Description

Arrays: Integer array Declaration and Initialization

Learning Objective: Understand how to declare and initialize arrays

In this problem, you will create a program that reads 5 integers from standard input, stores them in an int array, and displays all elements in one line separated by spaces.

Overview

Declare an array that can store 5 integer values, read values from standard input using Scanner, then create a program that outputs all array elements in order.

Specifications

  • Declare an int array with 5 elements
  • Use Scanner to read 5 integers from standard input and store them in the array
  • Output all array elements in one line separated by spaces

Input Format

integer1
integer2
integer3
integer4
integer5

Output Format

integer1 integer2 integer3 integer4 integer5

Example

Input:
1
2
3
4
5

Output:
1 2 3 4 5

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up