Help me fix this problem. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me fix this problem.

//Fibonacci Series Output - 0,1,1,2,3,5,8,13 $n=5; $a=[0,1]; for($i=0; $i<=$n; $i++){ //Write your code here in only 1 line $a[] = $a[count($a) - 1] + $a[count($a) - 2]; } echo implode($a,','); ?>

2nd Aug 2022, 5:35 PM
Karan Davande
Karan Davande - avatar
1 Answer
0
Why you declare $n=5? You want iterate in for to 13.
4th Aug 2022, 8:41 PM
Václav Dostál
Václav Dostál - avatar