下列程序段中没有错误的是______。
A: x=6For k=5 To 1 Step-1x=x+1NextPrint x
B: x=10While x>5x=x-1LoopPrint x
C: x=10Do While x>5x=x-1End DoPrint x
D: X=6Do While x>5x=x+1Loop Until x=10Print x
A: x=6For k=5 To 1 Step-1x=x+1NextPrint x
B: x=10While x>5x=x-1LoopPrint x
C: x=10Do While x>5x=x-1End DoPrint x
D: X=6Do While x>5x=x+1Loop Until x=10Print x
举一反三
- 下列程序段的执行结果为______。 x = 0: y = 1 z = 1: n = 0 Do x = x + y + z n = n + 1 Loop While x < 10 Print x; n A: 10 5 B: x n C: 9 5 D: 10 6
- 声明一个变量为局部变量应该用( )。 A: Private Sub Command1 Click() n=5:x=1 Do X=X * I I=I + 1 Loop While I < n Print x End Sub B: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X*I I=I + 1 Loop While I <n Print x End Sub C: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I<=n Print X End Sub D: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I>n Print X End Sub
- 以下代码中,最后x的值不是5的是哪一项?( ) A: x=1; while(x<5) { printf("%d\n",x); x++; } B: x=1; while(x<=5) { printf("%d\n",x); x++; } C: x=1; do { printf("%d\n",x); x++; }while(x<5); D: x=10; for( ;x>=6; x--) printf("%d\n",x);
- 以下程序段 。x=-1;do{ x=x*x; }while (!x);
- 以下程序段().x=-1;do{x=x*x;printf("%d",x);}while(!x);