用fact函数求阶乘求和的vb语言用过程法 +2!+3!+ +n!调用fact函数求阶乘之和
来源:学生作业帮助网 编辑:作业帮 时间:2024/12/02 14:28:46
xOk0ƿ($-[F.[eע?v,73KNcО
e /&ٷѐ]zEzGכO0uss~~9ŏ]|<[|pD_,gold1;?ױ|SyXc&DaWzanTq:T%mJڬ*7r^gV#Ÿ&=CBi q˜Tp hD< Gԇ.LP(ɽXРe nYxb/"?J=Ys9f V*q=L(J4wqDT %#}7Xyv!SM
$^ۃfJ-qM]iq(HwZT|U:
u[T>G`JG@%@nvku¿ōY{
用fact函数求阶乘求和的vb语言用过程法 +2!+3!+ +n!调用fact函数求阶乘之和
用fact函数求阶乘求和的vb语言用过程法 +2!+3!+ +n!调用fact函数求阶乘之和
用fact函数求阶乘求和的vb语言用过程法 +2!+3!+ +n!调用fact函数求阶乘之和
Option Explicit
Dim s As Integer
Private Sub Command1_Click()
Text2.Text = Str(fact(Val(Text1.Text)))
s = 0
End Sub
Private Function fact(n As Integer) As Integer
Dim i As Integer,j As Integer
j = 1
fact = 0
For i = 1 To n
j = j * i
s = s + j
Next i
fact = s
End Function