challenge-algorithms-v2.0/05-isPrime/index.js

12 lines
293 B
JavaScript
Raw Normal View History

2022-11-01 00:04:07 +00:00
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)
};