feat: cria algoritmo que resolve a função de Fibonacci. #4

Merged
emmanuelvitor merged 1 commits from feature/fibonacci into development/desafio-02 2022-10-31 15:14:32 +00:00

View File

@ -1,4 +1,11 @@
export function fibonacci(value) {
// implementar logica aqui
let term = 0, actual = 1, next;
for (let i = 1; i <= value; i++) {
next = term + actual;
term = actual;
actual = next;
}
return term
}