Private Sub Command1_Click()
Dim e As Single, t As Single, n As Integer '---------定义三个变量
e = 1: n = 0: t = 1 '---------------------------------对三个变量进行初始化
Do '-------------------------------------------------循环
n = n + 1 '-------------------------------------n为循环条件,从1,2,3...................
t = t / n '---------------------------------------计算1/1, 1/1*2 即1/n!的计算.
e = e + t '-------------------------------------得出结果 e=1+1/1!+1/2!+......+1/n!
Loop While t > 0.0000001 '--------------------循环结束条件,精确到第六位
Print e, n '- ------------------------------打印; e和n
End Sub