Dim n As Integer
Dim a() As Integer
Dim i As Integer
Private Sub Command1_Click()
n = Val(Text1.Text)
Dim str As String
str = ""
ReDim a(n)
For i = 1 To n
a(i) = InputBox("ÇëÊäÈëµÚ" & i & "¸öÊý×éÔªËصÄÖµ")
str = str & a(i) & " "
Next i
Label4.Caption = str
End Sub
Private Sub Command2_Click()
Dim sum As Integer
sum = 0
If i Mod 2 <> 0 Then
sum = sum + a(i)
End If
Text2.Text = sum
Dim n As Integer
Dim a() As Integer
Dim i As Integer
Private Sub Command1_Click()
n = Val(Text1.Text)
Dim str As String
str = ""
ReDim a(n)
For i = 1 To n
a(i) = InputBox("ÇëÊäÈëµÚ" & i & "¸öÊý×éÔªËصÄÖµ")
str = str & a(i) & " "
Next i
Label4.Caption = str
End Sub
Private Sub Command2_Click()
Dim sum As Integer
sum = 0
For i = 1 To n
If i Mod 2 <> 0 Then
sum = sum + a(i)
End If
Next i
Text2.Text = sum
End Sub