单选题 VB
题号 #2272661

下面是求最大公约数的函数的首部:
Function gcd(ByVal X As Integer,ByVal y As Integer)As Integer
若要输出8、12、16这3个数的最大公约数,下面正确的语句是(  )。

进入在线模考

参考答案

D

答案解析

D。【解析】GCD函数返回两个或多个整数的最大公约数,最大公约数是能分别将各个参数除尽的最大整数。其语法格戈为GCD(num1,num2,…),Num1,num2,…,为1~255个数值,如果参数为非整数,则截尾取整。所以本题正确的写法是9cd(8,gcd(12,16))。

你可能感兴趣的试题

A.For i=1 To 5
For j=1 To 3
Print a(j,i);
Next
Print
Next
B.For i=1 T0 3
For j=1 To 5
Print a(j,i);
Next
Print  Next
C.For j=l To 5
For i=1 To 3
Print a(j,i);
Next
Print
Next
D.For i=1 To 5
For=1 To 3
Print a(i,j):
Next
Print
Next
A.Private Sub P1 MouseMove(Button As Integer,Shift As Integer,X As Single,Y
As Single)
Print X Y
End Sub
B.Private Sub P1 MouseDown(Button As Integer,Shift As Integer,X As Single,Y
As Single)
Picture.Print X,Y
End Sub
C.Private Sub P1 MouseMove(Button As Integer,Shift As Integer,X As Single,Y
As Single)
P1.Print X,Y
End Sub
D.Private Sub Form MouseMove(Button As Integer,Shift As Integer,X As Single,Y
As Single)
P1.Print X,Y
End Sub
找试题 · 找答案 · 找资料 在线模考