主题:[讨论]vbscript 求圆周率
[b]求圆周率(要求精确到小数点后七位)[/b]
<html>
<head>
<title>无标题文档</title>
</head>
<body>
<script language=vbs>
dim i,s,n,pi
i=1
s=0
n=1
do until abs(pi-3.1415926)<0.0000001
s=s+1/i*n
i=i+2
n=-1*n
pi=s*4
loop
document.write "圆周率为" & pi
</script>
</body>
</html>
<html>
<head>
<title>无标题文档</title>
</head>
<body>
<script language=vbs>
dim i,s,n,pi
i=1
s=0
n=1
do until abs(pi-3.1415926)<0.0000001
s=s+1/i*n
i=i+2
n=-1*n
pi=s*4
loop
document.write "圆周率为" & pi
</script>
</body>
</html>