74.3k views
4 votes
How many times is the coin tossed?

var heads = 0;
var tails = 0;
var rolls = 100;
for(var i = 0; i < rolls; i++){
if(randomNumber(0,1) == 0){
heads++
} else {
tails++
}
}

2 Answers

2 votes

Answer:

100 times.

Step-by-step explanation:

The code will loop until i is equal to or greater than roles. I starts at zero and increases by one after each toss.

User Iceberg
by
5.8k points
5 votes
The answer is what the other guy said
User UsamaAmjad
by
5.3k points