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
OLga [1]
3 years ago
13

What does the following code segment do?

Computers and Technology
1 answer:
vampirchik [111]3 years ago
4 0

Answer:

Hi!

var count =0;  <em>//initialize count.</em>

var sevens =0 ;  <em>//initialize sevens.</em>

while(count<100)  <em>// loops while count is minor than 100. *counts never add 1 at the final of the loop, so this while is always true. </em>

{

<em>//Math.floor(x) round to the max Integer a number. Example : 45.90 -> 46.</em>

<em>//Math.random() returns a number between [0, 1).</em>

var roll1 = Math.floor(Math.random()*6+1);   <em>//Gets a integer using Math.random(), adds 1, and round it withMath.floor() then saves in roll1.</em>

var roll2 = Math.floor(Math.random()*6+1);  <em>//Gets a integer using Math.random(), adds 1, and round it withMath.floor() then saves in roll2.</em>

if(roll1 + roll2 == 7) <em> //If the sum of roll1 and roll2 is 7 adds 1 to sevens.</em>

sevens = sevens +1;  

}

<em>//*count is not incremented, so while(count<100) -> always true.</em>

You might be interested in
Internally, computers are constructed from circuitry that consists of small on/off switches. What is the most basic circuitry-le
attashe74 [19]

Answer:

Machine Language.

Explanation:

The most basic language that is used by computers so that they can control the operation of the on/off switches  in the circuitry is Machine language.

Machine Language is a low level language is a collection of binary digits or bits that is understood by the computers.Computers are capable of understanding only machine language.

3 0
3 years ago
Assume we have two lists, list A and list B. List A contains the numbers [20,10,20], while list B contains the numbers [40,10,30
Tcecarenko [31]

Answer:

5/ 18

Explanation:

Given :

List A: [20,10,20]

List B: [40,10,30,20,40,30]

Chance that number drawn from list A is larger than or equal to that drawn dlfrom list B.

If:

A = 20

B ≤ 20 : [10,20] = 2

A = 10

B ≤ 10 : [10] = 1

A = 20

B ≤ 20 : [10,20] = 2

Probability = Required outcome / Total possible outcomes

Hence,

required outcome = (2 + 2 +1) = 5

Total possible outcomes = 3C1 * 6C1 = (3 * 6) = 18

Hence,

chance that the number we drew from list A is larger than or equal to the number we drew from list B

= 5 / 18

8 0
3 years ago
What is the purpose of the Split command?
liq [111]

Answer:

a split command in the linux system re used for dividing large files into pieces

8 0
3 years ago
Read 2 more answers
Q) CITY column of a table contains information such as Bangalore , Bangalore-64 , Bangalore-56001 , Mumbai - 400002 etc in order
saw5 [17]
Data splitting:::::::::::)
7 0
4 years ago
What are the importance of computer software​
Katen [24]

Answer:

It controls and coordinates all hardware and software functions within your PC. It is designed to be ever-improving so that newer tasks are performed more efficiently.

4 0
2 years ago
Read 2 more answers
Other questions:
  • What does the shell of a operating system do?
    11·1 answer
  • Which description best explains a placeholder?
    7·1 answer
  • What term identifies the physical interface between a computer and its peripherals?
    5·1 answer
  • Write, compile, and test a program named PersonalInfo that displays a person's name, birthdate, work phone number, and cell phon
    5·1 answer
  • Companies expose themselves to harsh sanctions by federal agencies when they violate the privacy policies that their customers r
    8·1 answer
  • If you want to transfer information transform STM to LTM, it is essential that you make the information ______________________.
    9·1 answer
  • ¿Qué diferencia existe entre un virus biológico y virus informático?
    12·1 answer
  • I WILL GIVE MOST BRAINLY
    13·1 answer
  • Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    12·1 answer
  • When a file is used by a program, there are three steps that must be taken:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!