执行下列程序后,输出的结果是 Option Base 1 Private Sub Form_Click() Dim arr, s As Integer s = 0 arr = Array(2, 4, 6, 8, 10, 12, 14, 16, 18, 20) For i = 1 To 10 Step 2 If arr(i) Mod 3 = 0 Then s = s + arr(i) End If Next i Print s End Su
A: 20
B: 22
C: 24
D: 26
E: 28
F: 其它都不对
A: 20
B: 22
C: 24
D: 26
E: 28
F: 其它都不对
举一反三
- 运行下列程序,单击窗体显示的结果为( )。 Private Sub Form_Click() Dim a Dim s As Integer, i As Integer a = Array(1, 2, 3) For i = 2 To 0 Step -1 s = s + a(i) * a(i) Next i Print s End Sub
- 阅读程序: Option Base 1 Private Sub Form_Click() Dim arr, Sum Sum=0 art=Array(1, 3, 5, 7, 9, 11, 13, 15, 17, 19) For i=1 To 10 If arr(i)/3=arr(i)\3 Then Sum=Sum+arr(i) End If Next i Print Sum End Sub 程序运行后,单击窗体,输出结果为______。 A: 13 B: 14 C: 27 D: 15
- 在窗体上画一个名为Command1的命令按钮,然后编写如下代码: Option Base 1 Private Sub Command1_ Click() Dim arr(4, 4) For i = 1 To 4 For j = 1 To 4 arr(i, j) = (i - 1) * 3 + j Next j Next i For i = 1 To 2 For j = 1 To 2 Print arr(i, j) Next j Next i End Sub程序运行后,单击命令按钮,输出结果为______ 。 A: 3 4 6 7 B: 7 8 10 11 C: 1 2 4 5 D: 8 9 12 13
- 以下VBA程序运行的结果是( ) Public Sub Form_Click() Dim s As Integer s = 0 For i = 1 To 2 s = 1 For j = i To 3 s = s + i * j Next j Next i MsgBox "s=" &; s End Sub A: 11 B: 18 C: 22 D: 7
- 阅读程序: Option Base 1 Sub P(b() As Integer) For i=1 To 4 b(i)=2*i Next i End Sub Private Sub Form_Click() Dim a(4)As Integer For i=1 To 4 a(i)=i+4 Next i P a For i=1 To 4 Print a(i) Next i End Sub 运行上面的程序,单击窗体,输出结果为 A: 2 4 6 8 B: 5 6 7 8 C: 10 12 14 16 D: 4 8 12 16