// Trabalho feito por Bia Gabriela neves de azeveza e Illan de Souza spala
int main(void) {
int x, y, k;
float matriz1[3][3], matriz2[3][3], matriz3[3][3];
printf("Digite os valores pertencentes a primeira matriz 3x3, dando um espaço a cada número digitado: \n");
for (x = 0; x < 3; x++){
for (y = 0; y < 3; y++){
scanf("%f", &matriz1[x][y]);
}
}
printf("Digite os valores pertencentes a segunda matriz 3x3, dando um espaço a cada número digitado: \n");
for (x = 0; x < 3; x++){
for (y = 0; y < 3; y++) {
scanf("%f", &matriz2[x][y]);
}
}
for (x = 0; x < 3; x++){
for (y = 0; y < 3; y++){
matriz3[x][y] = 0.0;
for(k=0; k<3; k++){
matriz3[x][y] += matriz1[x][k] * matriz2[k][y];
}
}
}
printf("\nMatriz resultante:\n");
for (x = 0; x < 3; x++){
for (y = 0; y < 3; y++){
printf("%7.1f", matriz3[x][y]);
}
printf("\n");
}
return 0;
}
include
include
// Trabalho feito por Bia Gabriela neves de azeveza e Illan de Souza spala int main(void) { int x, y, k; float matriz1[3][3], matriz2[3][3], matriz3[3][3];
printf("Digite os valores pertencentes a primeira matriz 3x3, dando um espaço a cada número digitado: \n");
for (x = 0; x < 3; x++){ for (y = 0; y < 3; y++){ scanf("%f", &matriz1[x][y]); } }
printf("Digite os valores pertencentes a segunda matriz 3x3, dando um espaço a cada número digitado: \n");
for (x = 0; x < 3; x++){ for (y = 0; y < 3; y++) { scanf("%f", &matriz2[x][y]); } }
for (x = 0; x < 3; x++){ for (y = 0; y < 3; y++){ matriz3[x][y] = 0.0; for(k=0; k<3; k++){ matriz3[x][y] += matriz1[x][k] * matriz2[k][y]; } } } printf("\nMatriz resultante:\n"); for (x = 0; x < 3; x++){ for (y = 0; y < 3; y++){ printf("%7.1f", matriz3[x][y]); } printf("\n"); } return 0; }