...组合数公式为Cmn=m!/n!(m-n)!,编一程序,输入m和n的值,求Cmn的值...
发布网友
发布时间:2024-10-23 17:16
我来回答
共1个回答
热心网友
时间:6分钟前
Module Module1
Private Sub fac(ByVal x As ULong, ByRef y As ULong)
Dim i&, a&
a = 1
For i = 1 To x
a = a * i
Next i
y = a
End Sub
Sub Main()
Dim m&, n&, Cmn&, c1&, c2&, c3&
Console.WriteLine("m=")
m = Val(Console.ReadLine())
Console.WriteLine("n=")
n = Val(Console.ReadLine())
Call fac(m, c1) : Call fac(n, c2) : Call fac(m - n, c3)
Cmn = c1 / (c2 * c3)
Console.Write("Cmn={0}", Cmn)
End Sub
End Module