fibonacci series

@fib=(0,1); for ($k=1;$k<100;$k++) { if (($fib[$k]+$fib[$k-1])>100) { last; } push(@fib,$fib[$k]+$fib[$k-1]); } foreach (@fib) { print $_."\n"; }
This code will generate fibonacci series till 100. You can modify the code to generate further series.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.