FY B.sc IT Practical 3(C) : Write a JavaScript program to display all the prime numbers between 1 and 100.

 <!DOCTYPE html>

<html>

<head>

<title>prime number</title>

<script>

for(var i=1;i<=100;i++)

{

var flag=0;

for(var j=2;j<=i/2;j++)

{

if(i%j==0)

{

flag=1;

break;

}

}

if(flag==0)

{

document.write(i+"<br>");

}

}

</script>

</head>

</html>

Comments

Popular posts from this blog

Create an android app that demonstrates Activity Lifecycle and Instance State.

Program using Light Sensitive Sensors on Tinkercad