Saved Bookmarks
| 1. |
Suppose M[5][5] is a 2D array that contains the elements of a square matrix. Write C++ statements to find the sum of the diagonal elements. |
|
Answer» for (i = 0; i < 5, i++) for (j = 0; j < 5; j++) if (i == j) S = S + M[i][j]; |
|