执行循环结构循环后,n的值是:
Dim n As Short
n = -1
Do While 2 > 3
n = n + 1
Loop
Dim n As Short
n = -1
Do While 2 > 3
n = n + 1
Loop
举一反三
- 【填空题】设 n 和 s 均为整型变量,分别具有初值 1 和 10 。试指出下列循环语句的循环体各执行多少次,以及结束循环后 n 值各为多少? Do while n <= s n=n+3 Loop 循环体执行____(1)____次,结束循环后n值是______(2)______。 Do Until n*s>40 n=n*2 Loop 循环体执行____(3)____次,结束循环后n值是______(4)______。 while n<s n=n+3 Wend 循环体执行____(5)____次,结束循环后n值是______(6)______。 Do n=3*n Loop Until n>s 循环体执行____(7)____次,结束循环后n值是______(8)______。 Do n=s n=n+2 Loop While n<s 循环体执行____(9)____次,结束循环后n值是______(10)______
- 中国大学MOOC: 下面代码执行后,变量s的值为______。 Dim i, n As Integer, s As String i = 2 : n = 12 : s = n & = Do Until n = 1 Do While n Mod i = 0 s &= i & * n = n i Loop i += 1 Loop s = Strings.Left(s, Len(s) - 1)
- 下列语句中,不能实现循环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
- 下列语句中,不能实现循环100次的是 A: Do B: N=N+1 C: Loop Until N>=100 D: Do E: N=N+1 F: Loop While n<100 G: Do H: N=N+1 I: Loop Until N<100 J: Do While n<100 K: N=N+1 L: Loop
- 下面能正确计算1*2*3*•••*10的程序段是( )? do{ k=1;n=0;n=n*k;k++; }while(k<=10);|do{ k=1;n=1;n=n*k;k++; }while(k<=10);|k=1;n=1; do{ n=n*k;k++; }while(k<=10);|k=1;n=0; do{ n=n*k;k++; }while(k<=10);