Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Array Statistics | Functions Returning Arrays & Refactoring Loops
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C# Methods & Modular Thinking

bookChallenge: Array Statistics

Compito

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 CalculateSum method must return the sum of all elements in the numbers array.
  • The CalculateAverage method must return the average of the elements in the numbers array as a double.
  • If the numbers array is empty, CalculateAverage must return 0.0.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 4
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

close

bookChallenge: Array Statistics

Scorri per mostrare il menu

Compito

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 CalculateSum method must return the sum of all elements in the numbers array.
  • The CalculateAverage method must return the average of the elements in the numbers array as a double.
  • If the numbers array is empty, CalculateAverage must return 0.0.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 4
single

single

some-alt