- Practice
- Mathematics
- Linear Algebra Foundations
- Linear Algebra Foundations #1 - Matrix Addition
- Discussions

# Linear Algebra Foundations #1 - Matrix Addition

# Linear Algebra Foundations #1 - Matrix Addition

freud + 1 comment The question is very, very, badly worded. One value per line is definitely not clearly stated.

peel40 + 0 comments Why I'm getting wrong answer if my answer is correct? How should I submit my code?

public class Main { public static void main(String[] args) { int[][] m1 = new int[3][3]; int[][] m2 = new int[3][3]; int[] sum = new int[9]; int h = 1; m1[0][0] = 1; m1[0][1] = 2; m1[0][2] = 3; m1[1][0] = 2; m1[1][1] = 3; m1[1][2] = 4; m1[2][0] = 1; m1[2][1] = 1; m1[2][2] = 1; m2[0][0] = 4; m2[0][1] = 5; m2[0][2] = 6; m2[1][0] = 7; m2[1][1] = 8; m2[1][2] = 9; m2[2][0] = 4; m2[2][1] = 5; m2[2][2] = 7; h=0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { sum[h] = m1[i][j] + m2[i][j]; h++; } } for (int i=0; i<9; i++){ System.out.println(sum[i]); } } }

gautamxdeepak + 0 comments Don't write any code there. Just add those two matrices. And give the output as shown in the "Sample Output" :D

jae_duk_seo + 0 comments 5 7 9 9 11 13 5 6 8

this question is bit weird.

Oliver_Queenn + 0 comments [1 2 3] [4 5 6] [a b c] [2 3 4] + [7 8 9] = [d e f] [1 1 1] [4 5 7] [g h i] Just write the addition of the these matrix. No need to type the code. 5 7 9 9 11 13 5 6 8

michaelrobertre1 + 0 comments a1 = [1,2,3] a2 = [2,3,4] a3 = [1,1,1] A = [a1,a2,a3] b1 = [4,5,6] b2 = [7,8,9] b3 = [4,5,7] B = [b1,b2,b3] c1 = [] c2 = [] c3 = [] C = [c1,c2,c3] for n in range(len(A)): for i in range(len(A[n])): C[n].append(A[n][i] + B[n][i]) # C[0].append("string") # C[0].append("string") for n in range(len(C)): for i in range(len(C[n])): print int(C[n][i])

I don't get it. My code outputs:

5 7 9 9 11 13 5 6 8

But it still says the answer is wrong. I wrote and tested my code on repl.it and it printed out fine in the display there.

Am I losing my mind?

dxa187 + 0 comments do we need to write code for this pgm?

dban10 + 0 comments Why are poeple writing code for this when the question askes for literal values????!!!??

J_Headings + 0 comments Somethings wrong with this problem the correct answer results in a wrong answer.

unnamedproj + 1 comment Is there any specific format issues? I'm trying to submit: 5, 7, 9, 9, 11, 13, 5, 6, 8 and got wrong answer.

cielavenirAsked to answer + 1 comment one number per line (9 lines in total)

unnamedproj + 0 comments It has very inconvenient parser=((

Sort 12 Discussions, By:

Please Login in order to post a comment