下列程序执行后,变量x的值为( )。 Dim a,b,c,d As Single Dim x As Single a=10 b=30 c=400 If b>a Then d=a:a=b:b=d End If If b>c Then x=b Else

admin2010-11-20  38

问题 下列程序执行后,变量x的值为(    )。
Dim a,b,c,d As Single
Dim x As Single
a=10
b=30
c=400
If b>a Then
d=a:a=b:b=d
End If
If b>c Then
x=b
Else If a>c Then
x=c
Else
x=a
End If  

选项 A、10
B、30
C、400
D、430

答案B

解析 程序操作过程如下:程序首先执行If b>a Theh语句,条件为真执行d=a:a=b:b=d语句,执行后d=10,a=30,b=10;然后执行If b>c Then语句,条件不成立,因此执行Else If a>c Then语句;条件不成立,因此执行Else后面的x=a语句,执行后x=30。
转载请注明原文地址:https://kaotiyun.com/show/2Ymp777K
0

最新回复(0)