下面程序运行时内层循环的循环总次数是。
For m=1 to 3
For n=0 TO m-1
Next n
Next m
For m=1 to 3
For n=0 TO m-1
Next n
Next m
举一反三
- 下面程序运行时 For m=1 To 3 For n=0 To m-1 s=s+n Next n Next m 内层循环的循环总次数是 6次
- 有如下程序: Dim a(3,3)As Integer For m = 1 To 3 For n = 1 To 3 a(m,n)=(m-1)*3+n Next n Next m For m = 2 To 3 For n = 1 To 2 Print a(n,m); Next n Next m 运行后,输出结果是( )。
- 运行下列程序段,其中语句“n = n + 1”被执行的次数是()。 Dim m%... 1 Print n Next Next
- 中国大学MOOC: 有如下程序段: Dim i%, j%, n%, m%, k% m = 0 : k = 0 For i = 1 To 5 k = k + 1 n = 0 For j = 1 To 2 n = n + 1 m = m + 1 Next j Next i MsgBox(k & & n & & m)运行该程序代码段后,消息对话框中显示的内容为( )。
- 有如下程序段: Dim i%, j%, n%, m%, k% m = 0 : k = 0 For i = 1 To 5 k = k + 1 n = 0 For j = 1 To 2 n = n + 1 m = m + 1 Next j Next i MsgBox(k & " " & n & " " & m)运行该程序代码段后,消息对话框中显示的内容为( )。 A: 5 10 2 B: 5 10 10 C: 5 2 10 D: 5 2 2