Calculate the nth Fibonacci number.
Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ...
Examples:
Input n = 5
Output f is 5
Input n = 7
Output f is 13
but, loop and conditional statement is forbidden
Solution Stats
Problem Comments
7 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers851
Suggested Problems
-
2371 Solvers
-
2524 Solvers
-
Count consecutive 0's in between values of 1
515 Solvers
-
6298 Solvers
-
668 Solvers
More from this Author17
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Solve other problems from the problem set, Basics - Fibonacci, and the answer will reveal itself to you (after a little reflection). I promise.
Could you please tell me how to use recursion without condition?
Nice!
Interesting problem!!
It does require understanding of linear reccurence relations with constant coefficients. Interesting problem overall
Hint Instead using round which is forbidden.Try cast to other data types guys ( ͡° ͜ʖ ͡°)
you can use golden ratio for this problem.