PRIME OR NOT

<html>
<script language="javascript">
var x,i;
var dc=0;
x=parseInt(prompt("enter no"));
for(i=1;i<=x;i++)
{
if(x%i==0)
{
dc=dc+1;
}
}
if(dc==2)
{
alert("PRIME NUMBER");
}
else
{
alert("NOT A PRIME NO");
}
script>
html>



1 comments:

Post a Comment

Labels