004-001-013

Array Processing with Enhanced For Loop

Medium

Problem Description

Array Processing with Enhanced For Loop

Learning Objective: Understand how to efficiently process arrays using enhanced for loop (for-each)

Overview

Use enhanced for loop to process all array elements and calculate sum.

Specifications

  • Create integer array {5, 10, 15, 20, 25}
  • Output all elements using enhanced for loop
  • Calculate and output the sum

Output Format

Elements: 5 10 15 20 25
Sum: 75

Ready to Try Running Code?

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

Don't have an account?