VB程序中怎么求阶乘?
答案:3 悬赏:70 手机版
解决时间 2021-02-14 02:16
- 提问者网友:聂風
- 2021-02-13 04:07
VB程序中怎么求阶乘?
最佳答案
- 五星知识达人网友:渊鱼
- 2021-02-13 04:23
Dim n As Integer
Private Sub Command1_Click()
Dim i, t As Long
t = 1
For i = 1 To n
t = t * i
Next i
Text1.Text = t
End Sub
Private Sub Option1_Click()
n = 10
End Sub
Private Sub Option2_Click()
n = 11
End Sub
Private Sub Option3_Click()
n = 12
End Sub
Private Sub Command1_Click()
Dim i, t As Long
t = 1
For i = 1 To n
t = t * i
Next i
Text1.Text = t
End Sub
Private Sub Option1_Click()
n = 10
End Sub
Private Sub Option2_Click()
n = 11
End Sub
Private Sub Option3_Click()
n = 12
End Sub
全部回答
- 1楼网友:上分大魔王
- 2021-02-13 06:44
Private Sub Command1_Click()
Dim i%, n%, s&
s = 1
For i = 1 To 3
If CallByName(Me, "Option" & i, VbGet).Value Then n = i + 9: Exit For
Next
For i = 1 To n
s = s * i
Next
Text1 = s
End Sub
Dim i%, n%, s&
s = 1
For i = 1 To 3
If CallByName(Me, "Option" & i, VbGet).Value Then n = i + 9: Exit For
Next
For i = 1 To n
s = s * i
Next
Text1 = s
End Sub
- 2楼网友:骨子里都是戏
- 2021-02-13 05:52
Private Sub Command1_Click()
Dim i, b As Integer
Dim a As Double
a = 1
For i = 1 To b
a = i * a
Next i
'a为b的阶乘
Text1.Text = a
End Sub
Dim i, b As Integer
Dim a As Double
a = 1
For i = 1 To b
a = i * a
Next i
'a为b的阶乘
Text1.Text = a
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯