forked from M3-Academy/challenge-algorithms-v2.0
feat(fibonacci):aplicando a função no teste 4
This commit is contained in:
parent
961116c5b2
commit
518d2f4275
@ -1,4 +1,12 @@
|
||||
export function fibonacci(value) {
|
||||
// implementar logica aqui
|
||||
|
||||
let fib2 = 0
|
||||
let fib1 = 1
|
||||
let fibVal = 0
|
||||
for (let i = 1; i <=value; i++){
|
||||
fibVal = fib1 + fib2
|
||||
fib2 = fib1
|
||||
fib1 = fibVal
|
||||
}
|
||||
return fib2
|
||||
}
|
Loading…
Reference in New Issue
Block a user