程序执行结果s的值是 【14】 . Private Sub Command l-Click () I =0 Do S= I +S I = I + l Loop Until I >=4End Sub
F
举一反三
- 程序执行结果S的值是 【11】 。 Private Sub Command1_Click() i=0 Do i=i+1 s=i+s Loop Until i>=4 Print s 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
- 有如下程序段: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
- 下述程序段中,与其他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
内容
- 0
下列程序执行后s的值是____1____,i的值是____2____ s = 1: i = 1 Do While True s = s + i i = i + 2 If i = 7 Then Exit Do Loop
- 1
中国大学MOOC: 下面代码执行后,变量s的值为______。 Dim i, n As Integer, s As String i = 2 : n = 12 : s = n & = Do Until n = 1 Do While n Mod i = 0 s &= i & * n = n i Loop i += 1 Loop s = Strings.Left(s, Len(s) - 1)
- 2
下面程序的运行结果是______。 CLEAR S=0 i=-l DO WHILE i<=20 i=i+2 IF i%5!=0 i=i+1 LOOP ENDIF s=s+i ENDDO s A: 0 B: 30 C: 35 D: 45
- 3
下面程序计算并输出的是_______。 Private Sub Command1_Click() a=10 s=0 Do s=s+a*a*a a=a-1 Loop Until a<=0 Print s End Sub
- 4
以下程序段执行后,s的值为( )。 [br][/br]Dim i%, s% [br][/br]s = 0 [br][/br]i = 2 [br][/br]Do [br][/br] i = i + 1 [br][/br] s = s + i [br][/br]Loop Until i < 5 A: 7 B: 12 C: 3 D: 0