Challenge: Array Statistics
Taak
Swipe to start coding
Write two methods to calculate statistics for an array of integers. The first method should return the sum of all elements in the array. The second method should return the average value of the array as a double.
- The
CalculateSummethod must return the sum of all elements in thenumbersarray. - The
CalculateAveragemethod must return the average of the elements in thenumbersarray as a double. - If the
numbersarray is empty,CalculateAveragemust return0.0.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 2. Hoofdstuk 4
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Geweldig!
Completion tarief verbeterd naar 8.33
Challenge: Array Statistics
Veeg om het menu te tonen
Taak
Swipe to start coding
Write two methods to calculate statistics for an array of integers. The first method should return the sum of all elements in the array. The second method should return the average value of the array as a double.
- The
CalculateSummethod must return the sum of all elements in thenumbersarray. - The
CalculateAveragemethod must return the average of the elements in thenumbersarray as a double. - If the
numbersarray is empty,CalculateAveragemust return0.0.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 2. Hoofdstuk 4
single