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