有一段程序: a = Array(1, 2, 3, 4, 5, 6): s =1: For i = 5 To 1 Step -2: s = s * a(i): Next I, 执行后,s的结果是
48
举一反三
- 存在程序段: s=0 For i=1 to 10 step 2 s= s + 1 i= i * 2 Next i 当循环结束后,变量i ,s 的值分别为().
- 执行下列程序段后,程序的运行结果为()。 s = 1 For i = 1 To 3 For j = 0 To i - 1 s = s + s * j Next j Print s; Next i
- 运行下列程序,单击窗体显示的结果为( )。 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 = s + j 语句共执行了______次。 Dim s As Integer Dim i As Integer, j As Integer For i = 1 To 10 Step 2 For j = 1 To 5 Step 2 s = s + j Next j Next i Print s
- 下列程序段中,循环体s = s +1执行了几次? For i = 0 To 7 Step 3 For j = 0 To 7 Step 2 s = s + 1 Next Next
内容
- 0
已知程序段: s=0 For i=1 to 10 step 2 s=s+1 i=i*2 Next i 该程序段的循环次数是( )。
- 1
有以下程序,运行结果是()。 main() { int s[12]={1, 2, 3, 4, 4, 3, 2, 1, 1, 1, 2, 3}, c[5]={0}, i; for(i=0; i<12; i++) c[s[i]]++; for(i=1; i<5; i++) printf("%d", c[i]); printf("\n"); }
- 2
下列程序循环次数为______。 s = 0 For i = 1 To 20 Step 2 s = s + i Next i
- 3
程序段如下,程序运行后消息框显示的结果是______。 Dim a, s As String, i As Integer a = "晴空万里" s = "" For i = 1 To 4 Step 2 s &= Mid(a, 4 - i, 2) Next MsgBox(s)? 万里|晴空|万里晴空|晴空万里
- 4
执行下列程序段,则当循环结束后,变量i的值为______,变量s的值为______。 S=0 For i=1 To 10 Step 2 s=s+1 i=i*2 Next i