sandbox-php/PE2.php

23 lines
202 B
PHP
Raw Permalink Normal View History

2023-01-22 19:29:37 +01:00
<?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";
?>