feat: funcao fibonacci

This commit is contained in:
Caio Thurler 2022-10-30 09:27:58 -03:00
parent 18edddd101
commit 2954160e87

View File

@ -1,4 +1,10 @@
export function fibonacci(value) { export function fibonacci(value) {
// implementar logica aqui // implementar logica aqui
if (value < 1) {
return 0
} else if (value <= 2) {
return 1
} else {
return (fibonacci(value - 1) + fibonacci(value - 2))
}
} }