Option Base 1 '数组下标从一开始
Dim a(10) As Integer
Private Sub Command1_Click()
For i = 1 To 10
a(i) = InputBox("输入第" & i & "个数")
Next i
End Sub
Private Sub Command2_Click()
Dim max As Integer
Dim min As Integer
Dim sum As Integer
max = a(1)
min = a(1)
sum = 0
Print "数组元素是:";
For i = 1 To 10
Print a(i)
sum = sum + a(i)
If max < a(i) Then max = a(i)
If min > a(i) Then min = a(i)
Next i
Print
Print "最大值是:" & max
Print "最小值是:" & min
Print "平均值是:" & sum / 10
End Sub
Dim a(10) As Integer
Private Sub Command1_Click()
For i = 1 To 10
a(i) = InputBox("输入第" & i & "个数")
Next i
End Sub
Private Sub Command2_Click()
Dim max As Integer
Dim min As Integer
Dim sum As Integer
max = a(1)
min = a(1)
sum = 0
Print "数组元素是:";
For i = 1 To 10
Print a(i)
sum = sum + a(i)
If max < a(i) Then max = a(i)
If min > a(i) Then min = a(i)
Next i
Print "最大值是:" & max
Print "最小值是:" & min
Print "平均值是:" & sum / 10
End Sub