有下面程序代码: Private Sub Command1_Click() Dim sign As Integer sign = 1 a = 1 b = 2 For k = 1 To 5 c = a

admin2015-10-23  33

问题 有下面程序代码:
Private Sub Command1_Click()
    Dim sign As Integer
    sign = 1
    a = 1
    b = 2
    For k = 1 To 5
        c = a + sign * b
        a = b
        b = c
        Print c;
        sign = -sign
    Next k
End Sub
程序运行后,单击命令按钮Command1,输出结果是

选项 A、3  -1  2  -3  -1
B、3  5  8  13  21
C、-1  1  -2  -1  -1
D、3  4  5  6  7

答案A

解析 For循环执行5次,按公式计算可得,结果选A。
转载请注明原文地址:https://jikaoti.com/ti/2iJ0FFFM
0

最新回复(0)