下列程序段运行后X的值是().x = 0 For i = 1 To 5 For j = i To 3 x = x + 1 Next j Next i A.0 B.5 C.6

问题描述:

下列程序段运行后X的值是().x = 0 For i = 1 To 5 For j = i To 3 x = x + 1 Next j Next i A.0 B.5 C.6
下列程序段运行后X的值是().
x = 0
For i = 1 To 5
For j = i To 3
x = x + 1
Next j
Next i
A.0 B.5 C.6 D.15 C

i=1的时候,J=1,可以循环3次(1,2,3),此时x=3
i=2的时候,J=2,可以循环2次(2,3),此时x=5
i=3的时候,J=3,可以循环1次(3),此时x=6
所以选C