From 2954160e8726a42de74f214c9cea30df3923be36 Mon Sep 17 00:00:00 2001 From: Caio Thurler Date: Sun, 30 Oct 2022 09:27:58 -0300 Subject: [PATCH] feat: funcao fibonacci --- 04-fibonacci/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..a910901 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,10 @@ export function fibonacci(value) { // implementar logica aqui - -} \ No newline at end of file + if (value < 1) { + return 0 + } else if (value <= 2) { + return 1 + } else { + return (fibonacci(value - 1) + fibonacci(value - 2)) + } + } \ No newline at end of file