VB中的阶乘累加求和1!+2!+3!+4!+5!+6!+7!+8!+9!+10!=?
展开全部
Private Sub Form_Load()
Dim i As Integer, j As Integer, sum As Long, jiech As Long
sum = 0
For i = 1 To 10 '求和数
jiech = 0 '求阶乘时赋初始值0
For j = 1 To i '求i的阶乘
jiech = jiech + jiech * i
Next j
sum = sum + jiech '阶乘求和
Next i
Print sum '输出
End Sub
Dim i As Integer, j As Integer, sum As Long, jiech As Long
sum = 0
For i = 1 To 10 '求和数
jiech = 0 '求阶乘时赋初始值0
For j = 1 To i '求i的阶乘
jiech = jiech + jiech * i
Next j
sum = sum + jiech '阶乘求和
Next i
Print sum '输出
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询