Question
Write a program that calculates the product of two matrices containing real numbers. First, ask the user to define A, B, and C, where the first matrix must be of size (AxB; rows x columns) and the second matrix must be of size (BxC; rows x columns). If the dimensions do not allow a product to be calculated, output an error message. Next, dynamically create two arrays of the correct size and ask the user to enter in all values of each matrix. Calculate the resulting product, which will be a matrix of size AxC (rows x columns). Finally, output the resulting matrix, using four decimal places of precision. To create a dynamic 2-dimensional array, follow the example below, which dynamically creates an array with m rows and n columns:
Explanation / Answer
/* MCA-I NAME : JAY D SONI. ROLL NO : 154 SUBJECT : FUNDAMENTAL OF PROGRAMING DATE : 14/12/02 DEFINATION : */ #include #include void main() { int a[3][3],b[3][3],c[3][3]; int i,j,k,l = 1,m = 2; clrscr(); printf("---------------Enter the first matrix A-------------- "); for(i=0;i