From 33485e66ffdfc903d596dc17c3b1271b60001c53 Mon Sep 17 00:00:00 2001 From: Filipe Quintanilha Date: Fri, 28 Oct 2022 12:49:18 -0300 Subject: [PATCH] feat(fibonacci): desenvolvimento da funcao --- 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..eae7c30 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