程序执行结果S的值是 【11】 。 Private Sub Command1_Click() i=0 Do i=i+1 s=i+s Loop Until i>=4 Print s End Sub
举一反三
- 程序执行结果s的值是 【14】 . Private Sub Command l-Click () I =0 Do S= I +S I = I + l Loop Until I >=4End Sub
- 有如下程序段:s = 0For i = 1 To 10 s = s + iNext iPrint s与上述程序段输出结果相同的程序段为( )。 A: s = 0: i = 0 While i <= 10 i = i + 1 s = s + i Wend Print s B: s = 0: i = 1 While i < 10 i = i + 1 s = s + i Wend Print s C: s = 0: i = 1 Do s = s + i i = i + 1 Loop While i < 10 Print s D: s = 0: i = 1 Do s = s + i i = i + 1 Loop Until i > 10 Print s
- 声明一个变量为局部变量应该用( )。 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
- 运行下列程序,单击窗体显示的结果为( )。 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
- 下述程序段中,与其他3个程序段作用不同的是_______。 A: s=0 i=0 While i>100 s=s+1 Wend B: s=0 i=0 While i<100 i=i+1 Wend C: s=0 i=1 Do While i<100 s=s+1 i=i+1 Loop D: s=0 i=0 Do Until i>=100 s=s+1 i=i+1 Loop