万能百科  > 计算机   > 

[填空题] 有如下函数过程。 Function UNC(ByVal x As Integer,ByVal y As Integer)As Integer

2021-07-20   

[填空题] 有如下函数过程。

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并结束程序。[考点链接] 过程的定义和调用。

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

标签