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
Why is democracy the best form of government
julia-pushkina [17]

Democracy is the best form of government simply because no other form of government is known to work well. Democracy may have its flaws but all in all it .

3 0
3 years ago
At a murder scene, you have started making an image of a computer’s drive. You’re in the back bedroom of the house, and a small
GrogVix [38]

To preserve data, If you've previously emptied the RAM and registry, you may simply disconnect the power from the rear of the PC and remove the drive from the case; otherwise, if you want to save the entire system, you can carry the entire case with you.

<h3>What is a hard disk?</h3>

A hard disk drive or hard drive is a storage device that store data in an electronic device.

Thus, to preserve data, If you've previously emptied the RAM and registry, you may simply disconnect the power from the rear of the PC and remove the drive from the case; otherwise, if you want to save the entire system, you can carry the entire case with you.

Learn more about hard disk

brainly.com/question/14504942

#SPJ1

6 0
2 years ago
What do these symbols mean in technology
marta [7]

Answer:

1.us dollar which not not allow

2. pause botton

5 0
3 years ago
6.3.6: Adding to a Value codehs<br> help i don't know what to do .
QveST [7]

Question:

Write a function that adds together all values from 0 to a given value and returns the final number. For example, if the given value is `4`, you would add 0 + 1 + 2 + 3 + 4

Answer:

In Python:

def add_to_value(n):

   sum = 0

   for i in range(n+1):

       sum = sum + i

   

   return sum

Explanation:

This line defines the function

def add_to_value(n):

This line initializes sum to 0

   sum = 0

The following iteration adds from 0 to n

<em>    for i in range(n+1):</em>

<em>        sum = sum + i</em>

   

This line returns the calculated sum

   return sum

4 0
3 years ago
what is the least expensive way to connect five computers using a wired network to a router that has only four network ports?
ExtremeBDS [4]

Answer: Get wifi.

Explanation: Get wifi.

5 0
2 years ago
Other questions:
  • MTV can now be seen by most of the world's population. This is an example of
    7·1 answer
  • Două numere a și b sunt numite generatoare ale unui număr natural n dacă a∙b+[a/b]=n, unde s-a notat cu [c] partea întreagă a nu
    7·1 answer
  • Joshua needs to join in two cells together which of the following would perform the function
    14·1 answer
  • Why decomposition will be used in creating the algorithm for a game
    15·1 answer
  • Which of the following code segments does not contain any errors?
    7·1 answer
  • What is your favourite video game??​
    5·2 answers
  • 1. What runs horizontally and is identified with numbers?
    12·2 answers
  • All conductors,buses,and connections should be considered
    13·1 answer
  • The _____ constraint assigns a value to an attribute when a new row is added to a table
    5·1 answer
  • You can create an arraylist using _________. a. new arraylist[] b. new arraylist[100] c. new arraylist&lt;&gt;() d. arraylist()
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!