+ 3

How to use this function (C++) ?

I found this function in one of the challenges and I am not able to use this function to generate Fibonacci sequence, please help me. The program below contains just the function to show you guys. https://code.sololearn.com/cEJgpxcO1re4/?ref=app https://code.sololearn.com/cEJgpxcO1re4/?ref=app

16th Mar 2018, 4:26 PM
shubham p
shubham p - avatar
4 odpowiedzi
+ 1
I found the same function used in a book and it used a loop. So finally this is the code https://code.sololearn.com/cEJgpxcO1re4/?ref=app
16th Mar 2018, 5:29 PM
shubham p
shubham p - avatar
+ 1
I just wrote the function for this question
16th Mar 2018, 5:12 PM
shubham p
shubham p - avatar
+ 1
when I used blue's code (which I already did, but didn't work), I'm getting the output as 8
16th Mar 2018, 5:16 PM
shubham p
shubham p - avatar
+ 1
No, 'i' in the for loop should be initialized to 0 because Fibonacci sequence starts from 0.
17th Mar 2018, 8:45 AM
shubham p
shubham p - avatar