For i = 1 To 4 x = 4 For j = 1 To 3 x = 3 For k = 1 To 2 x = x + 6 Next k Next j Next i X=15?为什么
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 18:48:31
Fori=1To4x=4Forj=1To3x=3Fork=1To2x=x+6NextkNextjNextiX=15?为什么Fori=1To4x=4Forj=1To3x=3Fork=1To2x=x+6N
For i = 1 To 4 x = 4 For j = 1 To 3 x = 3 For k = 1 To 2 x = x + 6 Next k Next j Next i X=15?为什么
For i = 1 To 4 x = 4 For j = 1 To 3 x = 3 For k = 1 To 2 x = x + 6 Next k Next j Next i X=15?为什么
For i = 1 To 4 x = 4 For j = 1 To 3 x = 3 For k = 1 To 2 x = x + 6 Next k Next j Next i X=15?为什么
不要看最外层的循环
for i=1 to 4 当I=4时 x也是等于3
for j=1 to 3 当J=3时 x也是等于3
所以真正的循环为 for k=1 to 2
循环2次,第一次,x初值是3,执行x=x+6后x=9 第二次,x值是9,执行x=x+6后x=15也就是最后的结果