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
Is a list of instructions an arguments?<br> Yes or No
Bingel [31]

Answer: yes

Explanation:

5 0
3 years ago
Read 2 more answers
Without a/an ________. a computer is useless
Len [333]
Without a/an Operating system. a computer is useless
3 0
3 years ago
The rectangle shape in flowchart is used for
kvasek [131]
<h2>Start</h2>

The rectangle shape in flowchart is used to capture process steps like basic tasks or actions in your process.

4 0
3 years ago
Write a recursive method called printNumPattern() to output the following number pattern. Given a positive integer as input (Ex:
TiliK225 [7]

Answer:

See Explanation Below

Explanation:

// C++ printNumPattern() recursive method

// Comments are used for explanatory purpose

// Only the recursive is submitted

// Method starts here

void printPattern(int num1, int num2, bool dec)  

{  

// Print num2.  

cout << num2 << " ";  

//Printing to num1

if (dec == false && num1 ==num2)  {

 return;  }

// Printing to 0 or negative.  

if (dec)  

{  

// If num2 is greater than num2

if (num2-num1 > 0)  

 printPattern(num1, num2-num1, true);  

else // recur with false dec  

 printPattern(num1, num2-num1, false);  

}  

else // If dec is false.  

 printPattern(num1, num2+num1, false);  

}  

//End of recursive

7 0
4 years ago
Complete the sentence.
Luda [366]
The answer is Tablets
6 0
3 years ago
Other questions:
  • Show the contents of a queue after the following operations are performed. Assume the queue is initially empty. enqueue(45); enq
    6·1 answer
  • "bing ads keyword planner allows you to search for new keywords using a phrase, website, or category. from which bing ads tabs c
    13·1 answer
  • This is important I need help please
    14·1 answer
  • Powerpoint s _____ feature allows you to set the timing for a video clip
    12·1 answer
  • You can sort a large array of integers that are in the range 1 to 100 by using an array count of 100 items to count the number o
    9·1 answer
  • List six parts of a computer system and which are output and which is an input device
    5·1 answer
  • A(n) ________ software installation copies all the most commonly used files to your computer's hard drive.
    10·1 answer
  • What will you see on the next line?
    6·2 answers
  • A studio camera is generally small and lightweight enough to be taken out into the
    11·1 answer
  • Select all the correct answers. Which two statements are true about electric current through a circuit? Current flows from a pos
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!