下面程序运行后,语句“Print i”执行的次数是( )。 Private Sub Form_Click() Dim i As Integer,j As Integer i=0 Do i=i+1 Forj=10 To 1 Step-3 i=i+j Print i Next j Loop While i<50 End Sub
A: 4
B: 8
C: 12
D: 16
A: 4
B: 8
C: 12
D: 16
举一反三
- 下面程序执行时,输出的结果是______。 Private Sub Form_Click() Dim i As Integer,j As Integer i=10 Do i=i+j For j=10 To i Step-3 i=i+j Next j Loop While i<50 Print i;j End Sub A: 50 10 B: 50 9 C: 57 10 D: 57 9
- 下面程序执行时,输出的结果是( )。 Private Sub Form_Click() Dim i As Integer,j As Integer i=10 Do i=i+j for j=10 to step-3 i=i+j next i Loop While i<50 Print i; j End Sub A: A) 50 10 B: B) 50 9 C: C) 57 10 D: D) 59 9
- 运行下列程序,单击窗体显示的结果为( )。 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
- 运行下面的程序,第二行显示结果是___________。 Private Sub Form_Click() Dim A As Integer Dim i As Integer A = 5 For i = 1 To 9 Call sub1(i, A) Print i, A Next i End Sub Private Sub sub1(x As Integer, y As Integer) Static N As Integer Dim I As Integer For I = 3 To 1 Step -1 N = N + x x = x + 2 Next I y = y + N End Sub
- 阅读程序: 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