+ 13
Write a c++ prog. To check whether 55 is in Fibonacci series or not.
3 Answers
+ 2
Really nice question. I think the best way to do this would be to compute every fibonacci number up to N > 55 and check if N == 55 at every iteration.
Also (quote: https://stackoverflow.com/questions/2432669/test-if-a-number-is-fibonacci), you can be sure that a number is a fibonacci number if '5N^2-4' is a square number. The problem now is to check if the result is a square number, so still, I think the first option is better.
I'm writing a code in c++ for you to understand: https://code.sololearn.com/cSjk9vHUuJ5M
+ 8
thank you very much
+ 2
No problem, hope the code I wrote helps you ;) https://code.sololearn.com/cSjk9vHUuJ5M