<script> var x=parseInt(prompt("Enter the number","")) prime=1; for(var i=2;i<=x-1;i++) { if(x%i==0){ prime=0; break; } } if(prime){ document.write("Prime"); }else{ document.write("Not prime"); } </script>
Comments 1