Private Sub Form_Click()
Dim i As Integer
Dim sum As Double
Dim t As Double
sum = 0
i = 1
t = 1 / i
Do While t > 0.0001
sum = sum + t
i = i + 1
t = 1 / i
Loop
Debug.Print "i="; i; "sum="; sum
End Sub
一楼说的好,你倒是给答案啊
主体:
double n=1,sum=0
do
{
sum=sum+1/n
n=n+1
}
while(1/n>0.0001)
loop
print n
简单、