forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat: cria algoritmo que resolve a função de Fibonacci.' (#4) from feature/fibonacci into development/desafio-02
Reviewed-on: EmmanuelVitor/challenge-algorithms-v2.0-EmmanuelVitor#4
This commit is contained in:
commit
8ef075e164
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user