004-009-007

Multidimensional Array Access

Medium

Problem Description

Multidimensional Array Access

Learning Objective: Understand how to declare, initialize, and access elements of a 2D array by specifying row and column indices

Overview

Manage student test scores across subjects using a 3x3 two-dimensional array, accessing specific elements and calculating row averages.

Specifications

  1. Initialize a 3x3 two-dimensional integer array scores with the following values:

    • Row 0 (Student A): {85, 92, 78}
    • Row 1 (Student B): {90, 88, 95}
    • Row 2 (Student C): {72, 80, 68}
  2. Perform the following operations in order:

    • Print the score for Student B's second subject (index [1][1])
    • Print each student's average score, truncated to an integer (use integer division)

Output Format

Student B, Subject 2: 88
Student A average: 85
Student B average: 91
Student C average: 73

Ready to Try Running Code?

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

Don't have an account?