1
Read two integer matrices A and B (5 X 5) and, from them, manages the SOMA matrix (corresponding to the sum of the two matrices: A + B) and the matrix SUBTRACTION (corresponding to subtraction between the two matrices: A - B).
What I’ve done so far is:
var matrizA= [
[],[],[],[],[],
[],[],[],[],[],
[],[],[],[],[],
[],[],[],[],[],
[],[],[],[],[]
];
var matrizB=[
[],[],[],[],[],
[],[],[],[],[],
[],[],[],[],[],
[],[],[],[],[],
[],[],[],[],[]
];
for (var linha = 0; linha <= 4; linha++) {
matrizA = prompt("digite 5 valores para matrizA: ");
matrizB = prompt("digite 5 valores para matrizB: ")
for (var coluna = 0; coluna <= 4; coluna++) {
matrizA[linha][coluna] = matrizB[linha][coluna] = (linha + 1) + (coluna + 1);
document.write("[" + (linha + 1) + "] + [" + (coluna + 1) + "] =" + matrizA[linha][coluna] + matrizB[linha][coluna] + "<br>");
}
document.write("<br>");
}
Hi, I copied what you put in comment to the question. You can always [Edit] the question to clarify it. Avoid changing the direction of the question, but to clarify it is good to edit.
– Sergio
ok got it. end another attempt where I can go through the matrix row as far as the matrix column
– ana maria leite ramos