Skip to content

Instantly share code, notes, and snippets.

@xfry
Last active July 2, 2020 19:04
Show Gist options
  • Save xfry/a8f3b7d87b1cc2878fb24df1552da0d6 to your computer and use it in GitHub Desktop.
Save xfry/a8f3b7d87b1cc2878fb24df1552da0d6 to your computer and use it in GitHub Desktop.
A gist about Matrix Multiplication
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