X328: averageArray

Given an array of integers, return the average of all values in the array as a double. For example, if an array containing the values {10, 18, 12, 10} is passed in, the return value would be 12.5. If the array is empty, return 0.0.

Examples:

averageArray({10, 18, 12, 10}) -> 12.5
averageArray({}) -> 0.0

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.