单选题
VB
题号 #2535990
在窗体上画一个名称为Co mmand1的命令按钮,然后编写如下事件过程:
Private Sub Co mmand1_Click()
Di ma As Integer ,s As Integer
a=8
s =1
Do
s =s +a
a=a-1
Loop While a <=0
Print s ;a
End Sub
程序运行后,单击命令按钮,则窗体上显示的内容是( )。
参考答案
C
答案解析
本题考查Do ...Loop Whole 循环的使用。在本题的程序中,循环只执行一次就停止了,执行一次后,s =9,a=>20,不满足a<=0,所以循环结束。
你可能感兴趣的试题
A.a=InputBox()
B.a=InputBox("请输入一个值")
C.a=Val(InputBox("请输入一个值"))
D.a=Val(InputBox())
A.Form1的Caption 属性值为100
B.Form2的Caption 属性值为-100
C.Form1的Caption 属性值为-100
D.Form2的Caption 属性值为100