Merge pull request 'feat(fibonacci): Implementa função fibonacci' (#4) from feature/fibonacci into development
Reviewed-on: #4
This commit is contained in:
commit
920094b21a
@ -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;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user