sempombili21
sempombili21 sempombili21
  • 06-03-2022
  • Computers and Technology
contestada

Write an algorithm to calculate the average
value of array of integer elements

Respuesta :

sparshsrivastava
sparshsrivastava sparshsrivastava
  • 06-03-2022

Answer:

Explanation: Input : arr[] = {1, 2, 3, 4, 5}

Output : 3

Sum of the elements is 1+2+3+4+5 = 15

and total number of elements is 5.

So average is 15/5 = 3

Input : arr[] = {5, 3, 6, 7, 5, 3}

Output : 4.83333

Sum of the elements is 5+3+6+7+5+3 = 29

and total number of elements is 6.

So average is 29/6 = 4.83333.

Answer Link

Otras preguntas

What information do fossils provide about the history of organisms on Earth
O2 +C8H18--> H2O + CO2
A thermometer reading 5 degrees celsius is brought into a room with a constant temperature of 35 degrees celsius. a.) If the thermometer reads 15 degrees celsiu
The endosymbiotic theory provides an explanation for the origin of chloroplasts. Which trait of chloroplasts supports this explanation?
what are some of Dolley Madison's character traits?
what organelles does mitochondria work with
Which is a key element found in all carbohydrates, lipids, proteins, and nucleic acids? A. ammonia B. carbon C. nitrogen D. legumes
what did Hernan Cortes need for his expidition
What type of specialist has the job of advising policy makers on development, transportation, and parks?
how to solve 16x2-16x+4=9 using square root property