用随机函数产生60个200以内的数,

来源:百度知道 编辑:UC知道 时间:2024/06/04 16:49:39
就剩这么多分了!都给您了
用随机函数产生60个200以内的数,
打印出这些数(每行12个数),
从中找出素数,并将这些素数按升序排列。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>jsTest</title>
</head>
<script language="javascript">
function randoms(){
var num=new Array();
for(i=0;i<60;i++){
num[i]=Math.round(Math.random()*200);
document.writeln(num[i]);
}
}
</script>
<body onload="randoms()">
</body>
</html>

<script>
for (var i=0; i<60; i++) {
suiji=p