Contagion

<?php
    $rNaught = 2;
    $peopleInfected = 1;
    foreach (range(1, 365) as $day) {
        $sick = $rNaught * $peopleInfected;
        echo "Day " . $day . ", this many people infected: " . $sick . "<br />";
        $peopleInfected = $sick;
    }
?>
Vote up this code1
  • Elliot Gorokhovsky

    i think $rNaught and $sick were unnecessary…. u could have just done $peopleinfected *= 2… would have saved a ton of space…