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]
3 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]3 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
Which of the following is another term for a subfolder​
marin [14]

Answer:

below

Explanation:

subdirectory

5 0
3 years ago
A common attack in which a client's cookies, security tokens, or other personal information is obtained and used to impersonate
o-na [289]

Answer:

Identity Theft. i hope this helps :D

5 0
2 years ago
In a non-price rationing system, consumers receive goods and services first-come, first served. Give me an example of a time whe
Anna35 [415]

When someone may be giving away something for free.

7 0
2 years ago
In 1-2 sentences, describe how to use the thesaurus in the Word Processor you have used.
jasenka [17]
Thesaurus is a tool use to find the synonym of the of a word.
Here's the way to use the thesaurus in the word processor.
=> highlight the word, then right-click, Navigate to synonyms and the words will  display.
3 0
2 years ago
Read 2 more answers
What is an example of technology that helps support the idea of continental drift.
docker41 [41]

I don't know technology, but using Satellite images, we are able to see that the continents once fitted into one 'jigsaw'. This shows that the continents must have drifted to its original place. Furthermore, Geothermal stations have pointed out convection currents in the Earth's mantle has caused the movement of crusts.
8 0
2 years ago
Other questions:
  • Identify a major drawback of browsing web pages on mobile devices.
    15·1 answer
  • In Word, tables can be styled much like text can.<br> True<br> False
    6·1 answer
  • How much electricity is in the human brain? ​
    8·2 answers
  • Which type of microscope can only be used to view non-living specimens?
    10·2 answers
  • How does abstraction help us write programs
    11·1 answer
  • What is the difference between mutex lock and race condition​
    6·1 answer
  • Why I/O modules is needed between system bus<br>and I/O devices?​
    15·1 answer
  • What is the full form of RPM in computer ​
    10·2 answers
  • Which of the following tasks are suitable for creating an algorithm? Choose all that apply
    14·1 answer
  • Given an array of integers a, your task is to calculate the digits that occur the most number of times in the array. Return the
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!