0
prime numbre
please sameone help me creating a javascript code which give all the prime numbers between 2 integars a and b.(a>1,a<b,b<1001)
3 Réponses
+ 5
Arafet alaya ,
can you please show your attempt here?
this makes it easier to give hints or help you.
thanks!
+ 2
here you can see sir .
it's written in french but you can translate it .
var a = prompt('Entrer A: ');
var b = prompt('Entrer B: '); document.write(" les nombres premiers compris entre " + a + "et " + b + " sont: ");
for (var i = a; i <= b; i++)
{
var X = 0;
for (let j = 2; j < i; j++)
{ if (i % j == 0)
{ X = 1; }
}
if (i > 1 && X == 0)
{ document.write(i + "\n");
}
}
+ 1
Arafet alaya Your code is working perfectly fine.