VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2775
   ClientLeft      =   2520
   ClientTop       =   2025
   ClientWidth     =   3885
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   10.5
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   2775
   ScaleWidth      =   3885
   Begin VB.TextBox Text3 
      Enabled         =   0   'False
      Height          =   375
      Left            =   840
      TabIndex        =   7
      Top             =   2280
      Width           =   2295
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   840
      TabIndex        =   5
      Top             =   1800
      Width           =   2295
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   840
      TabIndex        =   4
      Top             =   1320
      Width           =   2295
   End
   Begin VB.Label Label5 
      Caption         =   "C="
      Height          =   255
      Left            =   360
      TabIndex        =   6
      Top             =   2280
      Width           =   255
   End
   Begin VB.Label Label4 
      Caption         =   "m="
      Height          =   255
      Left            =   360
      TabIndex        =   3
      Top             =   1800
      Width           =   255
   End
   Begin VB.Label Label3 
      Caption         =   "n="
      Height          =   255
      Left            =   360
      TabIndex        =   2
      Top             =   1320
      Width           =   255
   End
   Begin VB.Label Label2 
      Caption         =   "请输入n,m"
      Height          =   375
      Left            =   1200
      TabIndex        =   1
      Top             =   720
      Width           =   1575
   End
   Begin VB.Label Label1 
      Caption         =   "计算组合数"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   375
      Left            =   1200
      TabIndex        =   0
      Top             =   120
      Width           =   1575
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Function Cmn(n As Long, m As Long) As Long
    If n = 0 Then
      Cmn = 1
    ElseIf n = 1 Then
      Cmn = m
    ElseIf n > m \ 2 Then
      Cmn = Cmn(m - n, m)
    Else
      Cmn = Cmn(n, m - 1) + Cmn(n - 1, m - 1)
    End If
End Function

Private Sub Form_Click()
  Text3 = Cmn(Val(Text1.Text), Val(Text2.Text))
End Sub


