It keeps telling me the program took too long to finish before im even done


#1


Replace this line with your code.


#2

Could you please provide us with all of the code relating to the problem?


#3

$headcount = 0;
$tailcount = 0;
$flipcount = 0;
while ($headcount < 3):
$flip = rand(0,1)
$flipcount++;
if ($flip) {
$headcount = ++;
echo "

H
";
}
else {
$headcount = 0;
echo "
T
";
}
echo " It took {$flipcount} flips!";
endwhile;

#4

I'm pretty sure

$headcount = ++;

should actually be

$headcount++;

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.