Main.java 1 Complete the sumEvenindex method so that it takes in a 2-dimensional integer array and sums all numbers that
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Main.java 1 Complete the sumEvenindex method so that it takes in a 2-dimensional integer array and sums all numbers that
Main.java 1 Complete the sumEvenindex method so that it takes in a 2-dimensional integer array and sums all numbers that are in an even index or an even row. 2 3 4 5 6 7 8 For example, in the following array, the numbers with parentheses would be summed: class Main { public static void main(String[] args) { int[][] a = { {-5,-2,-3,7}, {1,-5,-2,2}, {1,-2,3,-4} }; System.out.println(sumEvenIndex(a)); // should print -6 } public static int sumEven Index(int[][] array) { 9 1 2 3 10 11 12 1 (4)(6)(3)(2) (4) 1 (2) 3 (1)(2)(6)(9) 13 14 2
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!