System.out.print(matrix [i] [j] + " ");
int sum = 0;
for (int row=0; row < matrix.length; row++)
for (int col=0; col < matrix[row].length; col++)
sum = sum + matrix[row];
I keep getting the wrong answers when the rows are added.
The sum for row 0 is 4 (should be 10)
Thank you for the opportunity to help you with your question!
the output is correct.
there is fault in line: sum = sum + matrix[row];
Thank you for pointing that out. I was assuming there was something wrong with that line, I am just not sure how to fix it.
Content will be erased after question is completed.
Enter the email address associated with your account, and we will email you a link to reset your password.
Forgot your password?