执行下列程序段后,变量y的值为( )。 Dim x As Integer,y As Integer x = 7 y = 3 If x >= 10 Then y = x - y ElseIf x>= 7 Then y = x + y Else y = x End If
A: 21
B: 10
C: 4
D: 3
A: 21
B: 10
C: 4
D: 3
举一反三
- 编写如下程序: Private Sub Command1_Click() Dim x As Integer, y As Integer x = 1: y = 1 Do y = x * y If y > 10 Then Print x, y Exit Do Else x = x + 3 End If Loop While x <= 10 End Sub 运行程序,输出结果为______
- 下列代码执行后,窗体上显示( )。 Dim x As Integer, y As Integer x = 50: y = 30 If x > y Then x = x - y Else y = y x If x < y Then x = x 20 Form1.Print x, y
- 下面程序段执行结果为( )。 x = 5 : y = -6 If not x > 0 Then x = y – 3 Else y = x + 3 End If Print x - y; y - x
- 若要求:当数学式3 A: if(x>3)if(x<7)y=1; B: if(x>3||x<7)y=1; C: if(x<3);elseif(x<7)y=1 D: if(!(x<=3))y=y;elseif(7>x)y=1;
- 【单选题】分段函数: ,下面程序段中正确的是__________。 A. If x < 0 Then y = 0 If x < 1 Then y = 1 If x < 2 Then y = 2 If x >= 2 Then y = 3 B. If x >= 2 Then y = 3 If x >= 1 Then y = 2 If x > 0 Then y = 1 If x < 0 Then y = 0 C. If x < 0 Then y = 0 ElseIf x > 0 Then y = 1 ElseIf x > 1 Then y = 2 Else y = 3 End If D. If x > =2 Then y = 3 ElseIf x > =1 Then y = 2 ElseIf x > =0 Then y = 1 Else y = 0 End If