Private Sub Command1_Click()
Print "n=5时,PI的近似值为"; PI(5)
Print "n=10时,PI的近似值为"; PI(10)
Print "n=20时,PI的近似值为"; PI(20)
End Sub
Function PI(m As Integer) As Double
For i = 1 To m
n = 1 / (i * i) + n
Next
n = Round(Sqr(n * 6), 5)
PI = n
End Function
3.14159