/* 2x2 Matrices (20 points) Part 1 (15 points) Write a complete C program that asks the user to enter the four entries of a 2x2 matix and then prints the determinant of the matrix on the screen. The program must: * ask the user to enter 4 floats: a,b, c, and d. * print the matrix in the following format | a b | | c d | * calculate and print the determinant (det = a*d - c*b). The program must define and use two functions float calc_determinant(float a, float b, float c, float d) void printMatrix(float a, float b, float c, float d) These functions do exactly what they their names suggest. Part 2 (5 points): Modify the program to ask the user to enter two 2x2 matrices and to print another matrix which is the result of adding the first two matrices. */ #include #include #include //Function to find determinant float calc_determinant(float a, float b, float c, float d) { return (a*d-c*b); } void printMatrix(float a, float b, float c, float d) { printf("| %5.2f %5.2f |\n", a, b); printf("| %5.2f %5.2f |\n", c, d); } int main(int argc, char** argv[]) { //ask the user the enter a 2x2 matrix // a b // c d float a,b,c,d; float det; printf("Please enter a 2x2 matrix:\n"); printf("\n\t| a\tb |\n\t| c\td |\n\n"); printf("a = "); scanf("%f",&a); printf("b = "); scanf("%f",&b); printf("c = "); scanf("%f",&c); printf("d = "); scanf("%f",&d); printf("\nYou entered:\n"); printMatrix(a,b,c,d); det = calc_determinant(a,b,c,d); printf("\nThe determinant of the matrix is %f.\n\n",det); system("pause"); return(0); }