<!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=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function isprime(n)
{
if(n<1) return false;
var i;
for(i=2;i<n;i++)
if (n%i==0) return false;
return true;
}
</script>
<script>
var i,n=0;
document.writeln("1-100之间的所有素数"+"</br>");
for(i=1;i<=100;i++)
{
if(isprime(i))
{
n++;
document.write(i+"\t");
if(n%5==0) document.writeln("</br>");
}
}
</script>
</head>
<body>
</body>
</html>
时间: 2024-10-09 11:52:49