VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   615
      Left            =   2040
      TabIndex        =   0
      Top             =   1800
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Click()
Dim i%, n&, t!, e!
  e = 0              ' 存放累加和结果
  i = 0               ' 计数器
  n = 1               ' 存放阶乘的值
  t = 1               ' 级数第i项值
   Do While t > 0.00001
     e = e + t
     i = i + 1
     n = n * i         ' 连乘，求阶乘
     t = 1 / n           ' 累加和
  Loop
  Print "计算了 "; i; " 项的和是 "; e
End Sub
'Private Sub Form_Click()
'Dim i%, n&, t!, e!
'   e = 1              ' 存放累加和结果
'   n = 1               ' 存放阶乘的值
'   For i = 1 To 10000
'     n = n * i          ' 连乘，求阶乘
'     t = 1 / n
'     e = e + t             ' 累加和
'If t <= 0.00001 Then Exit For
'  Next
'  Print "计算了 "; i; " 项的和是 "; e
'End Sub

