Last active
July 2, 2020 19:04
-
-
Save xfry/a8f3b7d87b1cc2878fb24df1552da0d6 to your computer and use it in GitHub Desktop.
A gist about Matrix Multiplication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void multiply(int m[3][3], int n[3][3]) | |
{ | |
int multiple[3][3], i, j, k, sum; | |
//multiply both matrix m and n | |
for(i=0;i<3;i++) | |
{ | |
for(j=0;j<3;j++) | |
{ | |
int sum=0; | |
for(k=0;k<3;k++) | |
{ | |
sum+= m[i][k] * n[k][j]; | |
} | |
multiple[i][j]=sum; | |
} | |
} | |
//print resultent matrix | |
printf("\nMultiplication of both Matrix is:\n"); | |
for(i=0;i<3;i++) | |
{ | |
for(j=0;j<3;j++) | |
{ | |
printf("%d\t",multiple[i][j]); | |
} | |
printf("\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment