fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void)
  5. {
  6. float Matrix_1[3][3] = {{3.4, 4.4, 1.2},{5.3, 5.7, 2.2},{6.2, -2.4, 0.9}};
  7. float Matrix_2[3][3] = {{7.3, 4.9, 3.7},{-2.4, 4.9, -10.2},{7.3, 5.2, 1.7}};
  8. int i, j, k;
  9. float result[3][3];
  10. for(i=0;i<3;i++)
  11. {
  12. for(j=0;j<3;j++)
  13. result[i][j]=0;
  14. }
  15. for (i = 0; i < 3; i++)
  16. {
  17. for (j = 0; j < 3; j++)
  18. {
  19. for(k = 0; k < 3; k++)
  20. {
  21. result[i][j] = result[i][j] + Matrix_1[i][k] * Matrix_2[k][j];
  22.  
  23. }
  24. }
  25. }
  26.  
  27. printf("The result of multiplying the matrices together\n");
  28. printf("%.3f\t%.3f\t%.3f\n",result[0][0],result[0][1],result[0][2]);
  29. printf("%.3f\t%.3f\t%.3f\n",result[1][0],result[1][1],result[1][2]);
  30. printf("%.3f\t%.3f\t%.3f\n",result[2][0],result[2][1],result[2][2]);
  31.  
  32. system("PAUSE");
  33. return 0;
  34. }
  35.  
Success #stdin #stdout #stderr 0s 2052KB
stdin
Standard input is empty
stdout
The result of multiplying the matrices together
23.020	44.460	-30.260
41.070	65.340	-34.790
57.590	23.300	48.950
stderr
sh: 1: PAUSE: not found