下列程序执行后,变量a的值为( )。 Dima,b,C,dAs Single a=10:b=20:c=40 If b>a Then d=a:a=b:b=d End If If c>a Then

admin2018-09-29  25

问题 下列程序执行后,变量a的值为(    )。
    Dima,b,C,dAs Single
    a=10:b=20:c=40
    If b>a Then
    d=a:a=b:b=d
    End If
    If c>a Then
    d=a:a=c:c=d
    End If
    If c>b Then
    d=b:b=c:c=d
    End If

选项 A、10
B、40
C、20
D、100

答案B

解析 本题考查选择语句。程序段中包括3条选择语句,其作用分别为:如果a小于b那么交换a和b,如果a小于c那么交换a和c,如果b小于c那么交换b和c,相当于对a、b、c做了降序排列。
转载请注明原文地址:https://kaotiyun.com/show/WQFp777K
0

最新回复(0)