更多"设有以下函数过程:
Function fun(m As Intege"的相关试题:
[填空题]设有以下函数过程:
Function fun(m As Integer) As Integer Dim k As Integer, sum As Integer sum = 0
For k = m To 1 Step -2
sum = sum + k
Next k
fun = sum
End Function
若在程序中用语句s=fun(10)调用此函数,则s的值为 _________。
[单项选择]设有以下函数过程:
Function fun(a As Integer,b As Integer)
Dim c As Integer
If a c=a:a=b:b=C
End IF
c=0
Do
c=c+a
Loop Until c Mod b=0
fun=c
End Function
若调用函数fun时的实际参数都是自然数,则函数返回的是( )。
A. a、b的最大公约数
B. a、b的最小公倍数
C. a除以b的余数
D. a除以b的商的整数部分
[单项选择]设有如下函数过程:
Function fun(a As Integer, b As Integer)
Dim c As Integer
If a<b Then
c=a:a=b:b=c
End If
c=0
Do
c=c+a
Loop Until c Mod b=0
fun=c
End Function
若调用函数fun时的实际参数都是自然数,则函数返回的是
A. a、b的最大公约数
B. a、b的最小公倍数
C. a除以b的余数
D. a除以b的商的整数部分
[填空题]设有以下函数过程:
Functio fun(m As Integer) As Integer
Dim k As Integer, sum As Integer
sum=0
For k=m To 1 Step -2
sum = sum+ k
Next k
fun=sum
End Function
若在程序中用语句s=fun(10)调用此函数,则s的值为 ______。
[单项选择]有如下一个函数过程:
Function Fun(a As Integer)
Static C
b=0:b=b+1:c=c+1
Fun=a+b+c
End Function
在窗体上添加一个命令按钮,事件过程如下:
Private Sub Command1_Click( )
Dim a As Integer
a=2
For i=1 To 3
Print Fun(
A. ;
[单项选择]有如下一个函数过程:
Function Fun(a As Integer)
Static c
b=0:b=b+1:c=c+1
Fun=a+b+c
End Function
在窗体上添加一个命令按钮,事件过程如下:
Private Sub Command1_Click( )
Dim a As Integer
a=2
For i=1 To 3
Print Fun(
A. ;
[单项选择]有下列函数过程:
Function fun1(ByVal x As Integer,ByVal y As Integer)As Integer
Do While y<>0
reminder=x Mod y
x=y
y=reminder
Loop
fun1=x
End Function 在下列按钮单击事件中调用该函数,则该程序的运行结果是( )。
Private Sub Command1_Click( )
Dim a As Integer
Dim b As Integer
a=100
b=25
x=fun1(a,b)
Print x
End Sub
A. 0
B. 25
C. 50
D. 100
[单项选择]有如下函数过程: Function fun1 (ByVal x As Integer, ByVal y As Integer) As Integer Do While y <> 0 reminder=x Mod y x=y y=reminder Loop fun1=x End Function 在下列按钮单击事件中调节器用该函数,则该程序的运行结果是( )。 Private Sub Command1_Click( ) Dim a As Integer Dim b As Integer a=100 b=25 x=fun1(a, b) Print x End Sub
A. 0
B. 25
C. 5O
D. 100
[单项选择]有如下函数过程:
Function Fun(By Val x As Integer,By Val y As Integer)As Integer
Do While Y<>0
reminder=x Mod y
x=y
y=reminder
Loop
Fun=x
End Function
以下调用函数的事件过程,该程序的运行结果是
Private Sub Command7_Click( )
Dim a As Integer,b As Integer
a=100:b=25
x=Fun(a,B)
Print x
End Sub
A. 0
B. 25
C. 50
D. 100
[单项选择]有如下函数过程。 Function Fun( By Val x As Integer,By Val y As Integer) As Integer Do While y <> 0 reminder = x Mod y xmy y = reminder Loop Fun = x End Function 以下调用函数的事件过程,该程序的运行结果是 Private Sub CommandT_Click( ) Dim a As Integer,b As Integer a = 100:b =25 x =Fun(a,B) Print x End Sub
A. 0
B. 25
C. 50
D. 100
[单项选择]有如下函数过程: Function fun1(ByVal x As Integer,ByVal y As Integer) As Integer Do While y<>0 reminder=x Mod y x=y y=reminder Loop fun1=x End Function 在下列按钮单击事件中调用该函数,则该程序的运行结果是( )。 Private Sub Command1_Click( ) Dim a AS Integer Dim b As Integer a=100 b=25 x=fun1(a,b) Print x End Sub
A. 0
B. 25
C. 50
D. 100
[单项选择]有以下函数过程:
Function Gys (ByVal x As Integer, ByVal y As Integer) As Integer
Do While y<>0
Reminder = x Mod y
x = y
y= Reminder
Loop
Gys=x
End Function
以下是调用该函数的事件过程,该程序的运行结果是
Private Sub Command1_Click( )
Dim a As Integer
Dim b As Integer
a = 50
b = 10
x=Gys (a,b)
Print x
End Sub
A. 0
B. 10
C. 50
D. 100