Jump to content

aurimasju

New Members
  • Posts

    2
  • Joined

  • Last visited

aurimasju's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I'm new to php so I'm trying to code some random stuff.. <?php $headCount = 0; $loopCount = 0; do { $flip = rand(0,1); if($flip = 0) { echo "<p>H</p>"; $loopCount++; $headCount++; } else { echo "<p>T</p>"; $loopCount++; $headCount = 0; } } while($headCount == 2 or $loopCount == 5); //should flip it til loopcount reach 5 or headcount reach 2 if($loopCount <= 5 && $headCount == 2) { echo "<p>We rolled " . $headCount . " heads in a row in " . $loopCount . " flips.</p>"; } else { echo "<p> " . $loopCount . " roll(s) was not enough to get two <b>H</b> in a row.</p>"; } ?> but all it does is in a screenshot .. thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.