From ba9a44473d9ed68401cd3572167c9960be75c659 Mon Sep 17 00:00:00 2001 From: Emilly Date: Tue, 1 Nov 2022 13:53:50 -0300 Subject: [PATCH] 05-resolvido --- 05-isPrime/index.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..03e80d4 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,18 @@ export function isPrime(value) { // implementar logica aqui - + let TotalDeivisores = 0; + for (let i = 1; i <= value; i++) { + if (value % i == 0) { + TotalDeivisores++ + } + } + if (TotalDeivisores == 2){ + return true; + } else return false; + if (value === 2){ + return true; + } + if (value === 1){ + return false; + } } \ No newline at end of file