<Feture>(fibonacci): implementação do código fibonacci

This commit is contained in:
Gabriel Ferraz Nogueira 2022-10-28 14:02:30 -03:00
parent 8aabaf9fad
commit 010ccfdb0e

View File

@ -1,4 +1,8 @@
export function fibonacci(value) { export function fibonacci(value) {
// implementar logica aqui // implementar logica aqui
const fibo = [0, 1]
for (let i = 2; i <= value; i++) {
fibo[i] = fibo[i-1] + fibo[i-2]
}
return fibo[value]
} }