Sum=0 For1=1to3 Forj=i to 4 For k=j to 5 Sum=sum+1 Nex k Next j Next i 执行上面的三重循环sum的值?怎么看哪儿是内循环?哪儿是外循环?

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 15:05:37
Sum=0For1=1to3Forj=ito4Fork=jto5Sum=sum+1NexkNextjNexti执行上面的三重循环sum的值?怎么看哪儿是内循环?哪儿是外循环?Sum=0For1=1to

Sum=0 For1=1to3 Forj=i to 4 For k=j to 5 Sum=sum+1 Nex k Next j Next i 执行上面的三重循环sum的值?怎么看哪儿是内循环?哪儿是外循环?
Sum=0 For1=1to3 Forj=i to 4 For k=j to 5 Sum=sum+1 Nex k Next j Next i 执行上面的三重循环sum的值?
怎么看哪儿是内循环?哪儿是外循环?

Sum=0 For1=1to3 Forj=i to 4 For k=j to 5 Sum=sum+1 Nex k Next j Next i 执行上面的三重循环sum的值?怎么看哪儿是内循环?哪儿是外循环?
程序写成这样的形式比较容易看出内外循环
相对而言
k是j的内循环,j是i的内循环,所谓嵌套循环了
Sum=0
For i=1 to 3
For j=i to 4
For k=j to 5
Sum=sum+1
Nex k
Next j
Next i

Sum=0 For1=1to3 Forj=i to 4 For k=j to 5 Sum=sum+1 Nex k Next j Next i 执行上面的三重循环sum的值?怎么看哪儿是内循环?哪儿是外循环? 一个循环语句问题.n=0For i=1 To 3Forj= -4 To -1n=n+1Next jNext i 运行结束后变量n的是多少? sum=0 for i= 1 to 100 sum=sum+i next i print sum 我不懂为什么要SUM=0又SUM=SUM+i 详 VB中的Dim sum As Integer语句Dim sum As Integersum = 0For i = 1 To 20sum = sum + ii = i + 1Next iPrint sum=; sum是怎么计算的 计算结果是多少 int i=0,sum=1; do{sum+=i++;} while(i double sum=0 与double sum=0.0 =IF(SUM(A1:A5)>0,SUM(A1:A5) =SUM('1:75'!C19), 有关sum的数学程序题开始 ↓ i=0 ↓ sum=0 ↓ → i≤64→否-------|| ↓是 || sum=sum+i |--i=i+1 | --------------| ↓ 输出sum ↓ 结束 为什么我的MATLAB,for程序只运行一次加和 sum=0; for i=2;10 sum=sum+i end ans = 10 sum = 2sum=0;for i=2;10sum=sum+iendans =10sum =2sum=0;for i=2;10sum=sum+iendans =10sum =2 dim i as integer dim sum as integer sum=0 for i=0 to 5 sum=sum+i next sum=? matlab 求亮度 程序,看不懂,function B=Brightness(Y)[m,n,d]=size(Y);b=0;if d==1B=sum(Y(:))/(m*n);endif d==3B(1)=sum(sum(Y(:,:,1)))/(m*n);B(2)=sum(sum(Y(:,:,2)))/(m*n);B(3)=sum(sum(Y(:,:,3)))/(m*n);end #include int main() { int n,a,sum=1,k; scanf(%d,&n); for(k=n;k>0;k--) sum=sum*k; // a=su sum:=sum*10+(j mod 10) i=1sum=0WHILE i int sum=0; for( int i=1; i S=0 i=1 sum=0 DO s=s+i i=i+1 sum=sum+s LOOP UNTIL i≥100 PRINT SUM END 是求什么的程序啊? ? Subscript indices must either be real positive integers or logicals. 什么错误啊?n=[1:15];x=zeros(1,15);x=rand(1,10);z=zeros(1,15);y=[x,0,0,0,0,0];forj=3:1:12z(j)=y(j-2)endsubplot(2,1,1);stem(n,y);subplot(2,1,2);stem(n,z)