下面程序运行后的结果为___ Private Sub Form_Click() Dim i%, sum% i = 1 Do While i < 5 sum = sum + i * i i = i + 2 Loop Print sum End Sub
A: 45
B: 35
C: 10
D: 25
A: 45
B: 35
C: 10
D: 25
举一反三
- 阅读程序: 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
- 执行循环后,两变量 I, Sum 分别是: Dim I As Short = 1 Dim Sum As Long = 0 Do While I <= 5 Sum += I I = I + 2 Loop
- 下列VBA程序段的执行结果为 。 I = 1 Do While I<=10 SUM = SUM + I I = I + 1 Loop Debug.Print SUM
- 声明一个变量为局部变量应该用( )。 A: Private Sub Command1 Click() n=5:x=1 Do X=X * I I=I + 1 Loop While I < n Print x End Sub B: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X*I I=I + 1 Loop While I <n Print x End Sub C: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I<=n Print X End Sub D: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I>n Print X End Sub
- 下面程序运行后,语句“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