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

Overview

Declare an array that can store 5 integer values, set the initial values to 1, 2, 3, 4, 5, then create a program that outputs all array elements in order.

Specifications

  • Declare an int array with 5 elements
  • Initialize the array with values 1, 2, 3, 4, 5
  • Output all array elements in one line separated by spaces

Input Format

(no input)

Output Format

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?