1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
melamori03 [73]
4 years ago
14

What is the value of the average variable after the following code is executed? var sum = 0; var prices = [14, 10, 9, 12, 11, 14

, 10, 8]; for( var i = 0; i < prices.length; i++ ) { sum = sum + prices[i]; } var average = sum/prices.length;
Computers and Technology
1 answer:
Reika [66]4 years ago
4 0

Answer:

The value of average is 11

Explanation:

Analyzing the program line by line

This line initializes sum to 0

var sum = 0;

This line defines an array named prices and it also fills it with integer values.

var prices = [14, 10, 9, 12, 11, 14, 10, 8];

The italicized lines is an iteration that adds every element of prices and saves the result in variable sum

<em>for( var i = 0; i < prices.length; i++ ) { </em>

<em>sum = sum + prices[i]; </em>

<em>}</em>

At this point, the value of sum is 88

The next line divides the value of sum (88) by the length of the array (8) which gives 11.

11 is then saved in variable average

var average = sum/prices.length;

You might be interested in
How do I delete my Brainly account?
Triss [41]

Answer:

yeah how? please tell me

Explanation:

5 0
2 years ago
Read 2 more answers
What is movie viewer, such as quicktime windows media player,an example of
Karo-lina-s [1.5K]
It is called the Databse
5 0
3 years ago
If you were describing system software for your car, what would be the functions of the system software?
Marat540 [252]
B would be the correct answer
7 0
3 years ago
What tool do windows server administrators use to create and manage user accounts?
AVprozaik [17]
Windows settings. 
1234567890
8 0
3 years ago
Which statement best describes the role of computing in entrepreneurship? Entrepreneurs can only be successful with modern compu
kykrilka [37]
Well according to e2020 the answer would be A. "Entrepreneurs can only be successful with modern computing technology."
5 0
3 years ago
Other questions:
  • Can someone fix this so that it only says "its a payday" on 15 and 30 and on all other days "sorry, it's not payday"
    9·1 answer
  • PLEASE HELP!!!!!!!!!!!
    15·2 answers
  • While working a night job at a call center, Eric creates an app called EatOut, which can be used to place orders at restaurants,
    14·1 answer
  • Reasons for the growth of decision-making systems include:
    13·1 answer
  • _____ _____ deals with the definitions properties of mathematical models of computation.
    8·1 answer
  • . Write a short program that asks the user to input a string, and then outputs the
    15·1 answer
  • IN C++ PLEASE!!!! Define a function FilterStr() that takes a string parameter and returns "Good" if the character at index 4 in
    7·1 answer
  • . Which of the following is NOT a
    12·1 answer
  • The best way to deal with crying children in the car is to ignore them or pull off the road
    15·1 answer
  • A(n) ______is like an intranet except it shares its resources with users from a distant location. Select your answer, then click
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!