VB求阶乘和1!+...+100!
答案:3 悬赏:0 手机版
解决时间 2021-03-28 14:09
- 提问者网友:动次大次蹦擦擦
- 2021-03-27 14:54
VB求阶乘和1!+...+100!
最佳答案
- 五星知识达人网友:撞了怀
- 2021-03-27 16:25
Private Sub Command1_Click()
Dim n, s, i As Double
For n = 1 To 100
c = 1
s=0
For i = 1 To n
c = c * i
Next i
s = s + c
n = n + 1
Next n
Print s
End Sub
Dim n, s, i As Double
For n = 1 To 100
c = 1
s=0
For i = 1 To n
c = c * i
Next i
s = s + c
n = n + 1
Next n
Print s
End Sub
全部回答
- 1楼网友:掌灯师
- 2021-03-27 17:44
Private Sub Command1_Click()
Dim i, n As Integer
For i = 1 To 100
n = n + i
Next i
Print n
End Sub
Dim i, n As Integer
For i = 1 To 100
n = n + i
Next i
Print n
End Sub
- 2楼网友:鱼忧
- 2021-03-27 17:24
Private Sub Command1_Click()
Dim n, s, i As Double
s=1
For n = 1 To 100
s=s*n
Next n
Print s
End Sub
Private Sub Command1_Click()
Dim n, s, i As Double
For n = 1 To 100
c = 1
For i = 1 To 10
c = c * i
Next i
s = s + c
n = n + 1
Next n
Print s
End Sub
这么做就好了,不用那么复杂
Dim n, s, i As Double
s=1
For n = 1 To 100
s=s*n
Next n
Print s
End Sub
Private Sub Command1_Click()
Dim n, s, i As Double
For n = 1 To 100
c = 1
For i = 1 To 10
c = c * i
Next i
s = s + c
n = n + 1
Next n
Print s
End Sub
这么做就好了,不用那么复杂
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯