#include<stdio.h> #include<conio.h> int main() { int mat1[3][3], mat2[3][3], mat3[3][3], sum=0, i, j, k; printf("Enter elements for Matrix 2: "); for(i=0; i<3; i++) { for(j=0; j<3; j++) scanf("%d", &mat1[i][j]); } printf("Enter elements for Matrix 2: "); for(i=0; i<3; i++) { for(j=0; j<3; j++) scanf("%d", &mat2[i][j]); } for(i=0; i<3; i++) { for(j=0; j<3; j++) { sum=0; for(k=0; k<3; k++) sum = sum + mat1[i][k] * mat2[k][j]; mat3[i][j] = sum; } } printf("\nMULTIPLICATION MATRIX\n"); for(i=0; i<3; i++) { for(j=0; j<3; j++) printf("%d\t", mat3[i][j]); printf("\n"); } getch(); return 0; }
C program to Multiply Two Matrix.
Reviewed by
on
December 25, 2019
Rating:
No comments: