问题 填空题

有如下函数过程。
Function UNC(ByVal x As Integer,ByVal y As Integer)As Integer
Do While y<>0
S=x/y
x=y
y=S
Loop
UNC=x
End Function
以下事件调用该函数,程序运行结果是 【7】
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a=12
b=2
x=UNC(a,b)
Print x
End Sub

答案

参考答案:F

解析:[命题目的] 考查考生对函数的定义和调用的运用。
[解题要点] 本题考查函数调用和输出格式的语句。调用UNC的过程如下:
x=12,y=2时,sic=6,x=2,y=6:
x=2,y=6时,sic=0,x=6,y=0;
y=0,所以跳出循环,输出x=6并结束程序。
[考点链接] 过程的定义和调用。

单项选择题
选择题