Friday, 22 November 2013

PHP : Fibonacci Code

Fibonacci Series :

$a = 0;
$b = 1;
$term = 7;
$i = 0;

echo $a." ".$b." ";
for($i; $i < $term -1 ; $i++)
{
$c = $b +$a;
echo $c." ";
$a = $b;
$b = $c;
}

Output :

1
1
2
3
5
8
13

To know about the Fibonacci Series in detail and also to know the codes of the Fibonacci Series in various other programming languages Click Here

If the above link doesn't work go to this URL :

No comments:

Post a Comment