Tuesday, 30 March 2021

1,1,2,3,5,8,13,21....n || Fibonacci series in php

 1,1,2,3,5,8,13,21....n Series in PHP Example



<?php

/* 1,1,2,3,5,8,13,21....n. */

$a=1;

$b=0;

$c=0;

$l=1;

while($l<=10)

{

$c=$a+$b;

print"<br>".$c;

$a=$b;

$b=$c;

$l++;

}

?>


No comments:

Post a Comment