A-A+
阅读程序:Function fac(ByVal As Integer)As Integer
问题详情
阅读程序:
Function fac(ByVal As Integer)As Integer
Dim temp As Integer
temp=1
For i%=1 To n
temp=temp*i%
Next i%
fac=temp
End Function
Private Sub Form. Click()
Dim nsum As Integer
nsum=1
For i%=2 T0 4
nsum=nsum+fac(i%)
Next i%
Print nsum
End Sub
程序运行后,单击窗体,输出结果是()。
A.35
B.31
C.33
D.37请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:C
C。【解析】本题考查的是函数的调用,Function函数的意义是某个数的阶乘,所以通过计算结果为4!+3!+2!+1!=33