Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var flips = 0;
- var howmanyheads = 0;
- var howmanytails = 0;
- var howmanyheadsandtails = 0;
- var headstreak = 0;
- while((headstreak < 200)){
- flips = flips + 1;
- console.log(flips);
- var coinside = randomNumber(1, 2);
- if (coinside == 1) {
- var howmanytails = howmanytails + 1;
- // write("The Coin Fliped Tails");
- write("Tails = " + howmanytails);
- howmanyheadsandtails = howmanyheadsandtails + 1;
- headstreak = 0;
- // write("Headstreak = " + headstreak);
- }
- if (coinside == 2) {
- var howmanyheads = howmanyheads + 1;
- // write("The Coin Fliped Heads");
- write("Heads = " + howmanyheads);
- howmanyheadsandtails = howmanyheadsandtails + 1;
- var headstreak = headstreak + 1;
- // write("Headsteak = " + headstreak);
- }
- }
- write("Total Flips = "+ howmanyheadsandtails);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement