From 90a275d6e8e1a8eede43fefe359510dc3fefe567 Mon Sep 17 00:00:00 2001 From: matheusjardimgarcia Date: Mon, 31 Oct 2022 21:04:07 -0300 Subject: [PATCH] Desafio 5 atualizado --- 05-isPrime/index.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..4b57ce4 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,12 @@ -export function isPrime(value) { - // implementar logica aqui - -} \ No newline at end of file +function isPrime(num) { + var resposta ; + for (var divisor = 2; divisor < num; divisor++) + if (num % divisor == 0 ) return false; + return true; +} + +var determinadoNumero = 60; + +for (var i = 2; i < determinadoNumero; i++) if (isPrime(i)) {console.log(i,true)}else{ + console.log(i,false) +}; \ No newline at end of file