Write a C program that does the following matrix operation: op1 and op2. For exa
ID: 3652867 • Letter: W
Question
Write a C program that does the following matrix operation: op1 and op2. For example, given 2*2 matrix A and matrix B, op1 is defined as follows: [?(A_1&B;_1@C_1&D;_1 )] op1 [?(A_2&B;_2@C_2&D;_2 )]=[?(A_1 A_2+B_1 C_2&A;_1 B_2+B_1 D_2@C_1 A_2+D_1 C_2&C;_1 B_2+D_1 D_2 )] (1) And op2 is defined as follows: [?(A_1&B;_1@C_1&D;_1 )] op2 [?(A_2&B;_2@C_2&D;_2 )]=[?(A_1 A_2&B;_1 B_2@C_1 C_2&D;_1 D_2 )] (2) In the main function do the following: Declare 3 4*4 2-D integer arrays (A, B, and Result) Get the dimension of the 2 matrices from the user (same size for both A and B, they are all square matrices) Get the values of the 2 matrices from the user, 1 row at a time Call function printMatrix to print matrix A Call function printMatrix to print matrix B Call function matrixOP1 to compute A op1 B, the result is put in matrix Result Call function printMatrix to print matrix Result Call function matrixOP2 to compute A op2 B, the result is put in matrix Result Call function printMatrix to print matrix Result Function prototypes are given as follows: Void printMatrix (int [][4], int dimension); Void matrixOP1 (int result[][4], int a[][4], int b[][4], int dimension); Void matrixOP2 (int result[][4], int a[][4], int b[][4], int dimension);Explanation / Answer
void matrixOP1(int result[][4],int a[][4],b[][4],int dimension) { int c, d, k, sum = 0; for ( c = 0 ; cRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.