You are on page 1of 1

Lab

Exercise 6

1. Write a program which reads two matrices A and B of sizes and , respectively,
from the user. Write functions to
(A) Print a given matrix such that each row gets printed on a new line
(B) Compute the sum of the two matrices A and B.
(C) Compute the product of the two matrices A and B.
(D) Compute the transpose of a given matrix. (Be careful to allocate the output
matrix of appropriate size)
(E) Compute the sum of the diagonal elements of a matrix.

You might also like