From a92b3f3aebec00110401c1242b65826443a347d5 Mon Sep 17 00:00:00 2001 From: Samuel Date: Thu, 27 Oct 2022 16:46:52 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Resolve=20o=20exerc=C3=ADcio=2004-fibon?= =?UTF-8?q?acci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-fibonacci/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..ba3a52b 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,11 @@ export function fibonacci(value) { // implementar logica aqui - + let a = 0, b = 1, c = value + + for (let i = 2; i <= value; i++){ + c = a + b; + a = b; + b = c; + } + return c; } \ No newline at end of file