write a javascript program to create an array from input box and find prime numbers in that array.
Answers
Answered by
0
function is Prime(num) {
for ( var i = 2; i < num; i++ ) {
if ( num % i === 0 ) {
return false;
}
}
return true;
}
function display(n) {
var arr = [2];
for ( var i = 3; i < n; i+=2 ) {
if ( isPrime(i) ) {
arr.push(i);
}
}
use arr result on your own
}
display(100);
Similar questions