for i=1 to 4x=2for j=1 to 3x=1for k=1 to 2x=x+3next knext jnext iprint x结果为什么是7?尽量详细点的,我很笨的!

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 05:53:07
fori=1to4x=2forj=1to3x=1fork=1to2x=x+3nextknextjnextiprintx结果为什么是7?尽量详细点的,我很笨的!fori=1to4x=2forj=1to3

for i=1 to 4x=2for j=1 to 3x=1for k=1 to 2x=x+3next knext jnext iprint x结果为什么是7?尽量详细点的,我很笨的!
for i=1 to 4
x=2
for j=1 to 3
x=1
for k=1 to 2
x=x+3
next k
next j
next i
print x
结果为什么是7?尽量详细点的,我很笨的!

for i=1 to 4x=2for j=1 to 3x=1for k=1 to 2x=x+3next knext jnext iprint x结果为什么是7?尽量详细点的,我很笨的!
按外循环循环一个,内循环循环一轮的原理.
k循环以外的j循环确定了每次循环开始时x都等于1,所以不管最外层的两层循环如何循环,最后一次循环时x都等于1,那么就看最内层的循环了,最内层k循环了2次,每次加3,再加上开始的1,最后就是7了.

VB 2个FOR循环语句求解答X=0For i= 1 to 4For j = 1 to ix= x+1 next j ,i 循环后X 求循环解释两个For 怎么循环 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?为什么 Dim x(3,5) As Integer For i = 1 To 3 For j = 1 To 5 x(i,j) = x(i - 1,j - 1) + i + j Next j Next iprint (3,4) For i=1 To 4 x=3 For j=1 to 3 For k=1 to 2 x=x+3 Next k Next j Next i text1.Value=Str(x) End Sub VB x=0 for i =0 to 4,for j =0 to i-1,x=x+(i+j-1),exit for next j,next i,print x. 2个矩阵相加,For i = 1 To 4For j = 1 To 4c(i,j) = a(i,j) + b(i,j)Picture3.Print c(i,j);If i = 1 And j = 1 ThenMax = c(i,j)ElseIf Max < c(i,j) Then Max = c(i,j):n = i:m = jEnd IfNext jPicture3.PrintNext i这个和For i = 1 To 4For j = 1 To 4c(i,j) for i=1 to 4 x=4 for j=1 to 3 x=3 fork=1 to 2 x=x+6 next k next j next i msgbox x 为什么结果是15 for(j=i+1;j Private Sub Command1_Click() For i=1 To 4 x=4 For j =1 To 3 x=3 For k=1 To 2 x=x+6 Next k Nex为什么只是加到第二步 怎么用lingo求解多目标规划呢,max =@sum(I(i):@sum(J(j):@sum(link(I,J):x(i)*w(j)*p(i,j)/d(i,j))));@for(I(i):@sum(J(j)|w(j)#eq#1:x(i)*p(i,j))>0);@for(I(i):@sum(J(j):x(i)*p(i,j)*c(j))>0);@for(J(j):@sum(link(I,J):x(i)*p(i,j)>=0));@for(l Private Sub Command1_Click() For i = 1 To 4 x = 4 For j = 1 To 3 x = 3 For k = 1 To 2 x = x + 6 NexPrivate Sub Command1_Click() For i = 1 To 4 x = 4For j = 1 To 3 x = 3 For k = 1 To 2 x = x + 6 Next kNext jNext iPrint xEnd Sub for (j=i private sub command_click() for i=1 to4 x=3 for j=1to3 for k=1 to 2 x=x+3 next k next j next i 输出输出str(x) Private Sub Form_click() Dim x,i,j x = 0 For i = 0 To 1 x = x + 1 For j = 0 To 3 If Not (j Mod 2)Private Sub Form_click()Dim x,i,jx = 0For i = 0 To 1x = x + 1For j = 0 To 3If Not (j Mod 2) Then x = x + 1Next jNext iPrint x=; xEnd Sub运行后结果 main() {int i,j,w=0; for(i=4; i; i--) for(j=1;j For j = 10 To i + 1 Step -1 for i= 1 to 3 x=4 for j = 1 to 4 x=x+6 next j next i print x 总共做了几次循环啊,结果为什么是28啊? 关于lingo程序的,sets:A/1..4/:c,b,n;X/A,A/:D;endsetsmin=1.1*n(1)+1.2*n(2)+1.3*n(3)+1.4*n(4);@for(A(i):@sum(A(j):c(i)*D(i,j)=1750);@for(A(i):@sum(A(j):n(i)*D(i,j)=b(i));@for(A(i):@gin(n(i)));@for(A(j):@for(A(i):@gin(D(i,j))));n(1)>n(2);n(2)>n(3);n