Question: JAVA Code: Complete the method, sumOdds(), below. The method takes in an array of integers, numbers, and returns the sum of all the odd numbers
JAVA Code:
Complete the method, sumOdds(), below. The method takes in an array of integers, numbers, and returns the sum of all the odd numbers in the array. The method should return 0 if the array contains no odd numbers.
For example, if the given array is [12, 10, 5, 8, 13, 9] then the method should return 27 (5+13+9=27).
Starter Code:
public class Odds { public static int sumOdds(int[] numbers) { //TODO: complete this method } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
