Menu
Hi guys,
I have a while loop in here that makes me think, what’s wrong? If I execute it the browser seems to take a lot of time to execute it, I did set the set_time_limit to 0, still it won’t execute. Here’s the code:
[code=php]
<?php
set_time_limit(0);
$a = 0;
$b = 1;
$c = 0;
$i = 0;
$j = 1;
$even_count = 0;
while($i < 10) {
$c = $a + $b;
$a = $b;
$b = $c;
if($c % 2 == 0) {
$even_count += $c;
}
}
echo “Sum of all even-valued terms: ” . $even_count;
?>
Any help is deeply appreciated. ?