feat: algoritmo 4

This commit is contained in:
Patrick Reis Santos 2022-10-30 11:33:25 -03:00
parent 456a54299d
commit ec60fd0248

View File

@ -1,4 +1,16 @@
export function fibonacci(value) { export function fibonacci(value) {
// implementar logica aqui let soma = 0;
let anterior = 0;
let proximo = 1;
if (value == 1) {
return (soma = 1);
}
for (let i = 2; i <= value; i++) {
soma = anterior + proximo;
anterior = proximo;
proximo = soma;
}
return soma;
// implementar logica aqui
} }