From 2e9b910a63ee8d451273625702591d53b09ee33c Mon Sep 17 00:00:00 2001 From: ueberjames Date: Fri, 28 Oct 2022 20:40:43 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20implementa=C3=A7=C3=A3o=20de=20algoritm?= =?UTF-8?q?o=20que=20retorne=20se=20o=20numero=20passado=20=C3=A9=20primo?= =?UTF-8?q?=20ou=20n=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05-isPrime/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..a27150e 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,11 @@ export function isPrime(value) { // implementar logica aqui + let numero = value + + for (let i = 2; i < numero; i++) + if (numero % i === 0) { + return false; + } + return numero > 1; } \ No newline at end of file