Ask Your Question By Comment We Will Give You Better Solution Soon

Wednesday 26 February 2014

Fibonacci Series in php

<?php
$a = 1;
$b = 2;
$term = 10;
$i = 0;

echo $a." ".$b." ";
for($i; $i<10 ; $i++)
{
$c = $b + $a;
echo $c." ";
$a = $b;
$b = $c;
}
?>

Output: 1 2 3 5 8 13 21 34 55 89 144 233 377

No comments:

Post a Comment