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

19 lines
443 B
JavaScript
Raw Normal View History

export function isPrime(value) {
// implementar logica aqui
2022-11-02 03:29:10 +00:00
const sampleInt = 2, 3, 5, 7, 11, 13, 17, 19, 23, 24, 31, 37, 41, 43, 47, 53, 54;
var primeBool = true;
var i;
if (sampleInt > 1) {
for (i = 2; i < sampleInt; i++) }
if (sampleInt % i == 0) {
primeBool = false;
break;
}
}
if (primeBool) {
console.log(`${sampleInt} is a prime number`);
} else {
console.log(`${sampleInt} is a not prime number`);
}