How to calculate 2D arrays and find the average. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to calculate 2D arrays and find the average.

30th Mar 2019, 3:44 AM
Mesut Awahab
Mesut Awahab - avatar
2 Answers
+ 2
Zlytherin great answer for 1D arrays. Mesut Awahab you will need two for-loops to loop through a 2D array. The inner loop will be for looping through the elements of the current array, and the outer loop will be for looping through the arrays, selecting each array to be looped through.
30th Mar 2019, 4:34 AM
Zeke Williams
Zeke Williams - avatar
0
Loop through the outer array, store the sum of each inner array inside an array
30th Mar 2019, 7:49 PM
jay