Written Method Called Sun Int Parameter Nums Want Sum Method Compute Sum Nums Code Bug Per Q43888330
plz solve in javaWe have written a method called sun with an int[] parameter nums. We want our sum method to compute the sum of nums, but our code has a bug (or perhaps bugs?) in it. TASK: Fix the bug(s) Sample Input: 1 2 3 4 5 Sample Output: 15 Write a program, test using stdin – stdout Time limit: 8 seconds Memory limit: 256 MB 1 static int sum(int[] nuns) { 2 int total -e; 3 for(int num : nums) { // for-each loop total + num; 1 point per submission Submit Show transcribed image text We have written a method called sun with an int[] parameter nums. We want our sum method to compute the sum of nums, but our code has a bug (or perhaps bugs?) in it. TASK: Fix the bug(s) Sample Input: 1 2 3 4 5 Sample Output: 15 Write a program, test using stdin – stdout Time limit: 8 seconds Memory limit: 256 MB 1 static int sum(int[] nuns) { 2 int total -e; 3 for(int num : nums) { // for-each loop total + num; 1 point per submission Submit
Expert Answer
Answer to We have written a method called sun with an int[] parameter nums. We want our sum method to compute the sum of nums, but…
OR