006-002-010

Nested For: 2D Array Processing

Hard

Problem Description

Nested For: 2D array Processing

In this problem, you will create a program that traverses a 2x3 2D array using nested for loops, outputs each row's elements, and calculates the total of all elements to standard output.

Learning Objective: Understand how to process 2D arrays using nested for loops

Overview

Create a program that outputs all elements of a 2D array and calculates the total.

Specifications

  • Initialize a 2x3 integer 2D array ({{1, 2, 3}, {4, 5, 6}})
  • Use nested for loops to output all elements by row
  • Calculate and output the total of all elements

Output Format

Row 1: 1 2 3
Row 2: 4 5 6
Total: 21

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