Question: Please answer question 1 and 2 A matrix in algebra is an array of numbers arranged in rows and columns. In C, it is common

 Please answer question 1 and 2 A matrix in algebra is

an array of numbers arranged in rows and columns. In C, it

Please answer question 1 and 2

A matrix in algebra is an array of numbers arranged in rows and columns. In C, it is common to implement Matrices using two dimensional arrays. We will be focusing on manipulating a fixed size 5x5 square matrix (5 rows and 5 columns) Create a C program called matrix.c that implements multiple functions doing each a specific task. The functions that you have to implement are the following: 1. Write a function that will fill a 5x5 matrix by randomly generated numbers. You can use rand) and srand) functions provided by library to generate random numbers between 1 and 100. The signature of the function is: void fillMatrix(int matrix[rows][cols]); rows and cols are global constants defined as follow at the beginning of your c file: #define rows 5 #define cols 5 2. Write a function that given a 5x5 matrix as parameter, will print each row of the matrix to the screen line by line. The signature of the function is: void printMatrix(int matrix[rows][cols]); Use array notation in your implementation. 3. In algebra, a transpose of a matrix is a matrix whose rows are the columns of the original. Write a function that will take a 5x5 matrix as parameter and thern transpose it in-place which means without the use of an extra or a temporary matrix while transposing. The signature of the function is: void transposeMatrix(int matrix[rows][cols]); Use pointer notation in your implementation. 4. Write a function that given three matrices as parameters (two as input matrices and one as output), will calculate the product of the first 2 matrices and place the result in the third one. The signature of the function is: void multiplyMatrix(int m1[2][cols], int m2[rows][cols], int resultMatrix[rows][cols]) Note that the first matrix isn't 5x5. Extra space in resultMatrix should be filled with zero. resultMatrix will hold the result of the multiplication of ml Xm2 Use pointer notation in your implementation The main) function that will be used to test your functions is provided as follow: int main() int matrix[rows][cols] fillMatrix(matrix); 1/Qi printMatrix(matrix); // 02 transposeMatrix(matrix); 3 printMatrix(matrix); int matrix2[2][cols]-(e,1,2,3,4,5,6,7,8,93; int matrixResult[rows] [cols]; multiplyMatrix(matrix2, matrix, resultMatrix); // Q4 printMatrix(matrixResult); return e

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!