sandbox-php/PE2.php
2023-01-22 13:29:37 -05:00

23 lines
202 B
PHP

<?php
$pre = 0;
$cur = 1;
$nex = 0;
$s = 0;
$cap = 4000000;
while ($cur <= $cap) {
$nex = $pre + $cur;
$pre = $cur;
$cur = $nex;
if ($cur % 2 == 0) {
$s = $s + $cur;
}
}
echo $s . "\n";
?>