Public Class Form1
Private Function jc1(ByVal q)
Dim i%, p%
p = 1
For i = 1 To q Step 1
p = p * i
Next
Return p
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim m!, n!, info1$, info2, C!, title$
title = "组合数计算小能手"
info1 = "请输入m的值"
info2 = "请输入n的值"
m = Val(InputBox(info1, title))
n = Val(InputBox(info2, title))
C = jc1(m) / jc1(n) / jc1(m - n)
Label1.Text = "结果是" & " " & C
End Sub
Private Sub Command1_Click() Dim m As Integer Dim n As Integer Dim y As Integer m = Val(InputBox("输入m")) n = Val(InputBox("输入n")) MsgBox "m和n最大公约数是:" & yue(m, n) End Sub