Skip to main content

Practice ยท 1 of 4

Safe average

CHALLENGE
Difficulty: beginner+25 XP

Implement static double SafeAverage(int[] values) โ€” the mean of the array, or 0 when the array is null or empty. One short-circuit guard makes this division-safe.

Back to lesson: Practice: Flow under pressure