forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat(challenge-4): completed challenge' (#4) from feature/challenge-4 into develop
Reviewed-on: #4
This commit is contained in:
commit
e99efef366
@ -1,4 +1,16 @@
|
|||||||
export function fibonacci(value) {
|
export function fibonacci(value) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
|
if (!value) return 0;
|
||||||
}
|
|
||||||
|
let n1 = 0,
|
||||||
|
n2 = 1,
|
||||||
|
nextTerm;
|
||||||
|
|
||||||
|
for (let i = 1; i <= value; i++) {
|
||||||
|
nextTerm = n1 + n2;
|
||||||
|
n1 = n2;
|
||||||
|
n2 = nextTerm;
|
||||||
|
}
|
||||||
|
|
||||||
|
return n1;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user