VB编程计算由下列公式确定的S值S = 1 + + + + … + ( A.frm)
问题描述:
VB编程计算由下列公式确定的S值S = 1 + + + + … + ( A.frm)
答
Public Function s(n)
Dim i,j,t,res
For i = 1 To n
t = 1
For j = 1 To i
t = t * j
Next
res = res + t
Next
s = res
End Function