1-2/2!+3/3!-4/4!+…(-1)^n+1*n/n!编写vb程序

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 04:21:27
1-2/2!+3/3!-4/4!+…(-1)^n+1*n/n!编写vb程序
x)357R67V57Q~԰LCP3.OP+O?OiOf%=_tWMR>z lȳ)(,$U!4I9?771/09'39[C%3W!OU4WQ'-1D, **y@g^AiS~ҋ}.ͳRQz?]O/|ָ^IbgBBHFjXķ8SA z=bzE% k=إV皗f)d5TWrH.DSZ Y`1Ԋ(! 38L ZֈД &h_\gֺ

1-2/2!+3/3!-4/4!+…(-1)^n+1*n/n!编写vb程序
1-2/2!+3/3!-4/4!+…(-1)^n+1*n/n!编写vb程序

1-2/2!+3/3!-4/4!+…(-1)^n+1*n/n!编写vb程序
Private Sub Command1_Click()
Dim n%,sum!,fact!
sum = 0
n = InputBox("输入n:","提示信息",1)
If n < 0 Then
MsgBox "数据有误!",48,"警告!"
End If
For i = 1 To n
fact = 1
For j = 1 To i
fact = fact * j
Next j
sum = sum + (-1) ^ (i + 1) * i / fact
Next i
Print sum
End Sub