Question 6 of 6 0 of 3 points Question 6 Unlimited tries (3) Assume you are given an int variable named sum and a 2-dime
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Question 6 of 6 0 of 3 points Question 6 Unlimited tries (3) Assume you are given an int variable named sum and a 2-dime
Question 6 of 6 0 of 3 points Question 6 Unlimited tries (3) Assume you are given an int variable named sum and a 2-dimensional array of ints that has been created and assigned to a2d. Write some statements that compute the sum of all the elements in the entire 2- dimensional array and assign the value to sum. 1 nPositive = 0; 2- for (int i = 0; i < a2d.length; i++) { 3- for (int j = 0; j < a2d.length; j++) { nPositive + a2d[j]> 0 ? 1 : 0; 4 5 6} 7 You almost certainly should be using: sum • I haven't yet seen a correct solution that uses: > • I haven't yet seen a correct solution that uses: ? • Solutions with your approach don't usually use: : 68 9 Code Analysis: Compiler Error(s) Remarks and hints