fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int A[2][2] = {{1,2},{3,4}};
  5. int B[2][2] = {{2,0},{1,2}};
  6.  
  7. int R[2][2] = {0};
  8.  
  9. int i,j,k;
  10.  
  11. for(i=0; i<2; i++){
  12. for(j=0; j<2; j++){
  13. for(k=0; k<2; k++){
  14. R[i][j] += A[i][k] * B[k][j];
  15. }
  16. }
  17. }
  18.  
  19. for(i=0; i<2; i++){
  20. for(j=0; j<2; j++){
  21. printf("%d ", R[i][j]);
  22. }
  23. printf("\n");
  24. }
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
4 4 
10 8