下列程序段的运行结果是 。 Subsele() Dim n As Integer i=21:n=3 Do While i>n i=i-n Loop Print i End Sub
A: 2
B: 4
C: 5
D: 3
A: 2
B: 4
C: 5
D: 3
D
举一反三
- 下列程序段的运行结果是( )。 Sub sele() Dim n As Integer i=21:n=3 Do While i>n i=i—n Loop Print i End Sub A: 3 B: 4 C: 5 D: 3.2
- 运行下面的程序,第二行显示结果是___________。 Private Sub Form_Click() Dim A As Integer Dim i As Integer A = 5 For i = 1 To 9 Call sub1(i, A) Print i, A Next i End Sub Private Sub sub1(x As Integer, y As Integer) Static N As Integer Dim I As Integer For I = 3 To 1 Step -1 N = N + x x = x + 2 Next I y = y + N End Sub
- 声明一个变量为局部变量应该用( )。 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
- 以下程序的输出结果是n=4 #include void main() { int i,n=0; for(i=2;i<5;i++) { do { if(i%3) continue; n++; } while(!i); n++; } printf("n=%d",n); }
- 下列程序的运行结果为( )。Private Sub Command1_Click() Dim a(5) As String Dim i As Integer For i = 0 To 5 a(i) = i + 1 Print a(i); Next iEnd Sub A: 123456 B: 6 C: 1 2 3 4 5 6 D: 0
内容
- 0
下列程序段的执行结果为_____。 Dim M(10),N(10) I=3 for T=1 To 5 M(T)=T N(I)=2*I+T Next T print N(I);M(I)
- 1
窗体上有一个名为Command1的命令按钮,编写如下事件过程: Private Sub Command1_Click() i = 0 Do While i < 8 For j = 1 To i n = n + 1 Next i = i + 1 Loop Print n End Sub 运行程序,单击命令按钮,则输出结果是______。
- 2
下列程序段的执行结果为( )。 Dim m(10),n(10) I=3 For I=1 to 5 M(t)=t N(I)=2*I+t Next t Print n(I);m(I) A: 3 11 B: 3 15 C: 11 3 D: 15 3
- 3
以下程序的运行结果是 Sub s1(b() As Integer) For i = 1 To 4 b(i) = 2 * i Next i End Sub Private Sub Command1_Click() Dim a(1 To 4) As Integer For i = 1 To 4 a(i) = i + 5 Next i s1 a() For i = 1 To 4 Print a(i) Next i End Sub
- 4
下面程序段执行后,n的值是()。inti,n=0;for(i=2;i<5;i++){do{if(i%3)continue;n++;}while(!i);n++;} A: 4 B: 5 C: 2 D: 3