- 1
find the sum of a two-dimensional array
3 Réponses
+ 2
You can browse the table using two nested loops
+ 2
Yes, just like this, considering an array arr[4][5]
for(int i=0; i<4; i++)
for(int j=0; j<5; j++)
sum+=arr[i][j]
0
What @Elegis said, you can nest two for loops. The first loop will loop through each array in the array, and the second loop will loop through each element in that array.