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

bookChallenge: Array Statistics

Tarefa

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.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 4
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Suggested prompts:

Can you explain this in simpler terms?

What are the main benefits or drawbacks?

Can you give me a real-world example?

close

bookChallenge: Array Statistics

Deslize para mostrar o menu

Tarefa

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.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 4
single

single

some-alt