1个回答
展开全部
Private Function Even(intData() As Integer) As Long
Dim i As Long, sum As Long, ic As Long
sum = 0
ic = 0
For i = LBound(intData) To UBound(intData)
If ((intData(i) Mod 2) = 0) Then
sum = sum + intData(i)
ic = ic + 1
End If
Next
Even = sum / ic
End Function
Private Sub Form_Click()
Dim intData(9) As Integer, i As Integer
Randomize
Me.Cls
For i = 0 To 9
intData(i) = 1 + CInt(99 * Rnd)
Next
Me.Print Even(intData)
End Sub
Dim i As Long, sum As Long, ic As Long
sum = 0
ic = 0
For i = LBound(intData) To UBound(intData)
If ((intData(i) Mod 2) = 0) Then
sum = sum + intData(i)
ic = ic + 1
End If
Next
Even = sum / ic
End Function
Private Sub Form_Click()
Dim intData(9) As Integer, i As Integer
Randomize
Me.Cls
For i = 0 To 9
intData(i) = 1 + CInt(99 * Rnd)
Next
Me.Print Even(intData)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询