Challenge: Array Statistics
Aufgabe
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.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 4
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Großartig!
Completion Rate verbessert auf 8.33
Challenge: Array Statistics
Swipe um das Menü anzuzeigen
Aufgabe
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.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 4
single