学校考试VB数组,谁会啊?10分。
a数组有3个数,B数组有6个数,a表示为a(1,2,3),B表示为B(1,2,3,4,5,6)现在要打印出a+b=5的数
参考答案:Dim a, b As Variant, i, j As Integer
a = Array(1, 3, 5)
b = Array(2, 4, 8, 9)
For i = LBound(a) To UBound(a)
For j = LBound(b) To UBound(b)
If Val(a(i)) + Val(b(j)) > 5 Then
Print a(i); b(j)
End If
Next j
Next i