diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..4530f54 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,14 @@ export function fibonacci(value) { // implementar logica aqui - + let fibM = value; + let fibMinus1 = 0; + let fibMinus2 = 1; + + + for (let i = 0; i < value; i++) { + fibM = fibMinus1 + fibMinus2; + fibMinus1 = fibMinus2; + fibMinus2 = fibM; + } + return fibMinus1 } \ No newline at end of file