关于循环嵌套的问题 初级问题请勿见笑 学习中
dim a as integer,i as integer,j as integera = 0
for i = 1 to 5
for j = -2 to 2
a = a + i + j
next j
print a;
next i
print i, j, a,
该段程序运行的结果是:5 15 30 50 75
5 3 75
我的理解是:当 i =1 时
执行 a = a + i + j
即: a = 0 + 1 + (-2) = -1
然后得到 :a = -1 赋值给 a
继续 : a = -1 + 1 + (-1) = -1
a = -1 + 1 + (0) = 0
a = 0 + 1 + (1)= 2
a = 2 + 1 + (2) = 5
当 i = 2 时
a = 0 + 2 + (-2) = 0
a = 0 + 2 + (-1) = 1
a = 1 + 2 + 0 = 3
a = 3 + 2 + 1 = 6
a = 6 + 2 + 2 = 10
当 i = 3 时
a = 0 + 3 + (-2) = 1
a = 1 + 3 + (-1) = 3
a = 3 + 3 + (0) = 6
a = 6 + 3 + (1) = 8
a = 8 + 3 + (2) = 13
...........
以此类推
请问它是怎样得到 5 15 30 50 75
5 3 75 的
也就是说具体的循环过程是怎样的 我知道我的解释肯定是错的 正确的应该如何循环