Skip to content

Instantly share code, notes, and snippets.

@uugr
Created April 16, 2012 16:09
Show Gist options
  • Save uugr/2399699 to your computer and use it in GitHub Desktop.
Save uugr/2399699 to your computer and use it in GitHub Desktop.
4x4 Matrix Multiplication
#include <stdio.h>
int main(){
int matA[4][4]={{0,1,2,3},{4,5,6,7},{8,9,10,11},{12,13,14,15}};
int matB[4][4]={{0,1,2,3},{4,5,6,7},{8,9,10,11},{12,13,14,15}};
int matC[4][4];
int i,j,k;
for (i=0;i<4;i++){
for(j=0;j<4;j++){
matC[i][j] = 0;
for(k=0;k<4;k++){
matC[i][j] += matA[i][k] * matB[k][j];
} printf("%5d",matC[i][j]);
} printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment