Assignment 8
Assignment 8
Spring 2022-23
INSTRUCTIONS
a) All programs should be written in C.
b) The file containing your solution to problem ‘x’ should be named roll-week8-probx.c where ‘roll’ is your roll
number.
c) Use indentation and comments as necessary. You are allowed to consult your books, notes or manual pages.
d) Upload the files separately on Moodle.
PROBLEMS
iii) A function to print all saddle points of a given matrix with m rows and n columns. The (i,j)-
th element is said to be a saddle point if it is the smallest element in row i and largest element
in column j, or vice versa.
b) Write a main function to read three matrices A, B and C, and test the three functions suitably as
mentioned above. Generate the outputs in suitably formatted form.
2. Write a main function to dynamically allocate a two-dimensional square matrix A of size n x n. Write the
following functions:
a) Multiply a matrix A with a scalar k, where both A and k are passed as parameters.
b) Compute A to the power p, where both A and p are passed as parameters. The result matrix is also
returned via parameter (space for the result matrix should also be dynamically allocated in the main
function).
c) Compute and print the matrix expression: 3A4 – 5A3 + 7A2 – 2A.
d) Given a matrix A of dimension 3 x 3, compute and return the determinant of the matrix.