004-010-003
Multidimensional Array Length: Sales Table Size
Easy
Problem Description
multidimensional array Length: Sales Table Size
In this problem, you will create a program that reads a sales table into a 2D array, retrieves the number of rows and columns, calculates the total number of cells, and displays the result to standard output.
Learning Objective: Get row and column count of 2D array
Get the number of rows (stores) and columns (months) from a sales table, and calculate total cells.
Input
Line 1: Number of stores n (1-3) and months m (1-3)
Following lines: Sales data for m months for each store
Output
Rows: [row count]
Columns: [column count]
Total cells: [rows x columns]
Example
Input:
2 3
100 150 120
80 90 110
Output:
Rows: 2
Columns: 3
Total cells: 6
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