Challenge 1: Declare an Array

In this challenge, you are required to make an array, and access its elements without using a debug trait.

We'll cover the following

Problem Statement

  • Declare an array, arr, of size 6 that has numbers divisible by 2 ranging from 0 to 10.

  • Print the value of arr

Output

The output of the code should be:

   0,2,4,6,8,10

Coding Exercise

Write your code below. It is recommended​ that you try solving the exercise yourself before viewing the solution.

Note: There is a test function given in the code for testing purposes. Do not modify it.

Important Note: Use the subscript notation,[], for accessing the values of an array. Do not use a debug trait.

Good luck!🤞

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy