Merge pull request 'feat(fibonacci): Implementa função fibonacci' (#4) from feature/fibonacci into development

Reviewed-on: #4
This commit is contained in:
Daniel_Moliari_Barbosa 2022-10-28 17:58:49 +00:00
commit 920094b21a

View File

@ -1,4 +1,13 @@
export function fibonacci(value) { export function fibonacci(value) {
// implementar logica aqui // implementar logica aqui
let first = 0;
let second = 1;
if (value <= 1) {
return value;
}
for(let i = 3; i <= value; i++){
second = first + second;
first = second - first;
}
return first + second;
} }