展开全部
Dim A(1 To 50) As Integer
Dim B(1 To 40) As Integer
Dim i, j As Integer
Dim n As Integer
Randomize (0)
j = 0
For i = 1 To 50
A(i) = Int((999 - 100 + 1) * Rnd + 100)
If A(i) Mod 2 = 0 Then
B(j + 1) = A(i)
j = j + 1
End If
Next i
'其中: 数组B中为所有的偶数, j为偶数的个数
Dim B(1 To 40) As Integer
Dim i, j As Integer
Dim n As Integer
Randomize (0)
j = 0
For i = 1 To 50
A(i) = Int((999 - 100 + 1) * Rnd + 100)
If A(i) Mod 2 = 0 Then
B(j + 1) = A(i)
j = j + 1
End If
Next i
'其中: 数组B中为所有的偶数, j为偶数的个数
追问
这个不能显示出数组啊,应该有print吧。求解,谢谢了。
追答
呵呵,原题中也没有要求输出啊,再加几句:
For i=1 to j
print B(i)
Next i
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询