AP Computer Science Amediummcq1 pt
Summing only the main diagonal of an n by n array needs
A.one loop adding a[i][i]
B.nested loops over all elements
C.no loop
D.sorting the array
Diagonal elements share the index.
Aone loop adding a[i][i]
Practice more AP Computer Science A questions with full explanations
Practice Unit 8: 2D Array Questions →