#include <iostream>
using namespace std;
void produtoMatricial(int A[2][3], int B[3][2], int C[2][2]) {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
C[i][j] = 0; // Inicializa o elemento C[i][j] como zero
for (int k = 0; k < 3; k++) {
C[i][j] += A[i][k] * B[k][j]; // Soma o produto dos elementos correspondentes
}
}
}
}
int main() {
int A[2][3] = {{1, 2, 3}, {4, 5, 6}}; // Matriz 2x3
int B[3][2] = {{7, 8}, {9, 10}, {11, 12}}; // Matriz 3x2
int C[2][2]; // Matriz resultado 2x2
produtoMatricial(A, B, C);
cout << "Matriz C (resultado):" << endl;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
cout << C[i][j] << " "; // Exibe cada elemento da matriz resultante
}
cout << endl; // Pula uma linha após cada linha da matriz
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: