...

View Full Version : prime-number-generator



vasech
08-26-2012, 10:06 PM
write any number in and the browser will give out the primes who exist until your number.


<html>
<head>
<script type="text/javascript">

function addInput(form) {
var up = form.inputbox.value;
for (x=0; x<=up; x++){
count = 0;
for (y=0; y<=x; y++){
g = x/y;
if (g%1===0){
count += 1;
}
}
y=0;
if (count === 1){
document.write(x + "<br>");
}
if (count === 2){
document.write(x + "<br>");
}
}
}
</script>

</head>
<body>
<div style="font-family:arial;">Prime-generator</div><p>
<div style="font-size:10px; font-family:arial;">some text for description.</div><p>
<form name="form" method="get">
<input type="text" name="inputbox" value=""/>
<input type="button" onclick="addInput(this.form)" name="button" value="go"/>
</form>
</body>
</html>
}

vnit969
09-12-2012, 06:43 PM
Nice work



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum