feat(desafio04):desafio-completo #4

Merged
nicolasrosadeoliveira merged 1 commits from feature/desafio04 into develop 2022-10-28 13:26:19 +00:00
Showing only changes of commit a0e3f1c4a5 - Show all commits

View File

@ -1,4 +1,14 @@
export function fibonacci(value) { export function fibonacci(value) {
// implementar logica aqui // implementar logica aqui
if (value < 1) return 0
if (value <= 2) return 1
let fibMinus2 = 0
let fibMinus1 = 1
let fibN = value
for (let i = 2; i <=value; i++){
fibN = fibMinus1 + fibMinus2
fibMinus2 = fibMinus1
fibMinus1 = fibN
}
return fibN
} }