
Java
For the resulting matrix, just add the corresponding elements from each of the matrices you add. Use coordinates, like "i" and "j", to loop through all the elements in the matrices. For example (for
Java; code is similar in C):
for (i = 0; i <= height - 1; i++)
for (j = 0; j<= weidht - 1; j++)
matrix_c[i][j] = matrix_a[i][j] + matrix_b[i][j]