From 248abe8613aa1e6af2c902bff3b31f63ec186ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Gabriel?= <=> Date: Fri, 28 Oct 2022 08:00:31 -0300 Subject: [PATCH] =?UTF-8?q?feat(isPrime):=20Feito=20quinto=20exerc=C3=ADci?= =?UTF-8?q?o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05-isPrime/index.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..417092d 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,15 @@ export function isPrime(value) { - // implementar logica aqui - + let prime; + let cont = 0; + for (let i = 0; i <= value; i++) { + if (value % i === 0) { + cont++; + } + } + if (cont > 2) { + return false; + } else { + return true; + } + } \ No newline at end of file