单选题 VB
题号 #484403

现有如下程序:
Private Sub Command 1_Click()
s=0
For i=1 T0 5
s=s+f(5+i)
Next
Print S
End Sub
Public Function f(x As Integer)
If x>=10 Then
t=x+1
Else
t=x+2
End If
f=t
End Function
运行程序,则窗体上显示的是(  )

进入在线模考

参考答案

B

答案解析

Function过程f(x)的功能是:当x>=10时,返回x+1;否则,返回x+2。S的值为f(6),f(7),f(8),f(9),f(10)的和,即8,9,10,11,11之和,即49。所以,答案是B。

你可能感兴趣的试题

找试题 · 找答案 · 找资料 在线模考