diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..413eee1 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,13 @@ export function fibonacci(value) { // implementar logica aqui + let fibo = []; + let i = 0; + for (i = 0 ; i <= value; i++) { + if (i < 2) + fibo[i] = i; + else + fibo[i] = fibo[i-1] + fibo[i-2]; + } + return fibo[value]; } \ No newline at end of file