下列语句中,不能实现循环100次的是
A.N=0 Do N=N+1 Loop Until N>=100
B.N=0 Do N=N+1 Loop While n<100
C.N=0 N=N+1 Do Loop Until N<100
D.N=0 Do While n<100 N=N+1 Loop
第1题:
执行以下的循环后输出的值为( )。 public class Sun { public static void main(String args[ ]) { int m=1000,s=0,n=0; do{ n=n+1; s=s+(int)Math.pow(2,n); }while(s<=m); System.out.println("n="+n+","+"s="+s); } }
A.n=9,s=1000
B.n=8,s=1022
C.n=9,s=1022
D.n=8,s=1000
第2题:
以下程序段中Do...Loop循环执行的次数为______。 n=5 Do if n mod 2=0 then n=n\2 else n=n*3+1 end if Loop until n=1
A.4
B.3
C.5
D.2
第3题:
要使循环体至少执行一次,应使用()循环
A.For-next
B.While-wend
C.Do--Loop while|until
D.do[while|until]-loop
第4题:
以下程序段中Do...Loop循环执行的次数为( )。 n=5 Do lf n Mod 2=0 Then n=n\2 Else n=n*3+1 End If Loop untiln=1
A.4
B.3
C.5
D.2
第5题:
下列程序段中是死循环的是()
A.int n=1; while(!n) n++;
B.int n=1; do{n--;} while(n);
C.int n=1; do{ n+1; } while(n)
D.for(n=5;n<1;) ;