阅读下面程序,当单击窗体后,窗体上输出的是___________。PrivateSubForm_Click()DimiAsInteger,jAsIntegerDimkAsIntegerFori=1To10Step3Forj=1To10Step2Ifj>=5Theni=i+3:ExitForj=j+1k=k+1NextjIfi>8ThenExitForNextiPrinti;j;kEndSub(5.0分)
举一反三
- 单击窗体,在窗体上打印数列:2/1 ,3/2 ,5/3 ,8/5 ,13/8 … 的前10项,并求其和,将和保存在变量s中。 Private Sub Form_Click() Dim i%, j%, k%, m As Integer Dim s As Single s = 0 i = 2 'i为分子 j = 1 'j为分母 For k = 1 To 10 s = 【1】 Print i & "/" & j m = j j = i i = 【2】 Next Print s End Sub
- 运行下列程序段,语句“k = k + 1”的执行次数总共是()。For i = 1 To 10 Step 3 For j = 1 To i k = k + 1 Next jNext i A: 11 B: 12 C: 21 D: 22
- 运行以下程序,单击命令按钮后在窗体上输出内容_________。Private Sub Command1_Click()Dim a() As IntegerDim i As Integer, j As IntegerReDim a(3, 4)For i = 1 To 3For j = 1 To 4a(i, j) = i* 10 + jNext jNext iReDim a(4, 5)Print a(2, 3)End Sub
- 执行下列程序段后,输出结果是 n = 0 For i=1 To 3 For j=5 To 1 Step -1 n = n + 1 Next j, i Debug.Print n; j; i
- 在窗体上画一个名为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