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