/* Program to find the * of two matrices & store the result in new one */ /* Problem 20 */ #include #include main() { static int a[5][5],b[5][5],c[5][5]; int i,j,m,n,k; clrscr(); printf("Please enter the matrix's m (in mxn) : "); scanf("%d",&m); printf("Also enter the matrix's n (in mxn) : "); scanf("%d",&n); printf("\nEnter the elements for matrix 'A' (separated by or ) : "); printf("\n\n"); for (i = 0; i < m; i++) for (j = 0; j < n; j++) scanf("%d",&a[i][j]); printf("\nAnd enter the elements for matrix 'B' (separated by or ) : "); printf("\n\n"); for (i = 0; i < m; i++) for (j = 0; j < n; j++) scanf("%d",&b[i][j]); printf("\n\nThe product of the two matrices given is as follows,"); printf("\n\n"); for (i = 0; i < m; i++) { for (j = 0; j < n; j++) { for (k = 0; k < n; k++) c[i][j] += a[i][k] * b[k][j]; printf("%4d",c[i][j]); } printf("\n"); } printf("\n\nPress any key to exit..."); getch(); }