IllanSpala / UFES-1-PERIODO-PROG-C

Projetos feitos em 2022 no meu primeiro período de programação, utilizando a lingugagem C
0 stars 0 forks source link

Produto de Matrizes em C #4

Open IllanSpala opened 1 year ago

IllanSpala commented 1 year ago

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; }