VB编程题:输入m,n的值,求组合数c(m,n)的值 麻烦各位大虾看看我这段代码哪里出问题了
PrivateSubCommand1_Click()Dimm%,n%,i%,xm=InputBox("请输入m的值:")n=InputBox("请输入n的值:")x=F(...
Private Sub Command1_Click()
Dim m%, n%, i%, x
m = InputBox("请输入m的值:")
n = InputBox("请输入n的值:")
x = F(m) / (F(n) * F(m - n))
Print "组合数c(m,n)的值为:"; x
Print F(m), F(n), F(m - n)
End Sub
Private Function F(ByVal i As Integer) As Integer
If i = 1 Then
F = 1
Else
F = i * (i - 1)
End If
End Function 展开
Dim m%, n%, i%, x
m = InputBox("请输入m的值:")
n = InputBox("请输入n的值:")
x = F(m) / (F(n) * F(m - n))
Print "组合数c(m,n)的值为:"; x
Print F(m), F(n), F(m - n)
End Sub
Private Function F(ByVal i As Integer) As Integer
If i = 1 Then
F = 1
Else
F = i * (i - 1)
End If
End Function 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询