0
How to add two 3×3 matrices by using 1D array in java ???
3 odpowiedzi
+ 8
int[] matrix1 = {1,2,3,4,5,6,7,8,9};
int[] matrix2 = {5,2,5,7,9,6,4,8,3};
int[] sum = new int[matrix1.length]
for (int i = 0;i < matrix1.length;i++)
sum[i] = matrix1[i] + matrix2[i];
+ 7
Isn't it better to add matrices using 2D arrays, that makes more sense
+ 1
but someone has asked me the same question