From af4f3269cc2be38f5ed08b6e18bef52254a3e0dd Mon Sep 17 00:00:00 2001 From: Nicolas Oliveira <110689312+thedevnicolas@users.noreply.github.com> Date: Fri, 28 Oct 2022 10:31:56 -0300 Subject: [PATCH] feat(desafio05):desafio-completo --- 05-isPrime/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..b3b6f2a 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,13 @@ export function isPrime(value) { // implementar logica aqui - + if(value == 0 || value == 1) { + return false +} + +for(let div = 2; div <= Math.sqrt(value); div++){ + if(value % div == 0) { + return false + } +} +return true } \ No newline at end of file