Created
November 3, 2019 20:42
-
-
Save gegen07/4d02c7a77ebb7cae79ffcf7b03025032 to your computer and use it in GitHub Desktop.
This is an algorithm to multiplying two matrix
This file contains 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
#include <stdio.h> | |
int main() { | |
int matriz[3][3], matriz1[3][3] = {{1, 2, 3}, {2, 3, 1}, {3, 2, 1}}, matriz2[3][3]={{1, 2, 3}, {2, 3, 1}, {3, 2, 1}}; | |
for (int k = 0; k < 3; k++) { | |
for (int i = 0; i < 3; i++) { | |
int aux = 0; | |
for (int j = 0; j < 3; j++) { | |
aux += matriz1[k][j] * matriz2[j][i]; | |
} | |
matriz[k][i] = aux; | |
aux = 0; | |
} | |
} | |
for (int i = 0; i < 3; i++) { | |
for (int j = 0; j < 3; j++) { | |
printf("%d ", matriz[i][j]); | |
} | |
printf("\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment