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          =   495
      Left            =   1200
      TabIndex        =   0
      Top             =   2160
      Width           =   2295
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim a%(1 To 5), b%(2 To 10), i%, t1#, t2#
    For i = 1 To 5          ' 简化a数组的数据输入
        a(i) = i
    Next i
    For i = 2 To 10          ' 简化b数组的数据输入
        b(i) = i
    Next i
    t1 = tim(a())                   ' 调用函数tim
    t2 = tim(b())                   ' 调用函数tim
    Print "t1="; t1, "t2="; t2  ' 输出结果：t1=120  t2=20160
End Sub

Function tim(a() As Integer)
    Dim t#, i%
    t = 1
    For i = LBound(a) To UBound(a)      ' 求数组的下界和上界
        t = t * a(i)
    Next i
    tim = t
End Function

