展开全部
修改好了测试成功,但是,基本上,偶数和会大于所有的数
Private Sub Command1_Click()
Dim a(10) As Double
Dim t As Double
Randomize
For i = 1 To 10
a(i) = Int(Rnd * 100 + 2) '设十个数,给十个数随机赋值
If a(i) Mod 2 = 0 Then t = t + a(i): Print "偶数为"; a(i)
Next i
Print "偶数的和为"; t
For i = 1 To 10
If a(i) < t Then Print "小于偶数和的数"; a(i)
Next i
End Sub
Private Sub Command1_Click()
Dim a(10) As Double
Dim t As Double
Randomize
For i = 1 To 10
a(i) = Int(Rnd * 100 + 2) '设十个数,给十个数随机赋值
If a(i) Mod 2 = 0 Then t = t + a(i): Print "偶数为"; a(i)
Next i
Print "偶数的和为"; t
For i = 1 To 10
If a(i) < t Then Print "小于偶数和的数"; a(i)
Next i
End Sub
参考资料: 如果您的回答是从其他地方引用,请表明出处
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |