VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3585
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4740
   LinkTopic       =   "Form1"
   ScaleHeight     =   3585
   ScaleWidth      =   4740
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "退  出"
      Height          =   375
      Left            =   2880
      TabIndex        =   10
      Top             =   2880
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "计  算"
      Height          =   375
      Left            =   360
      TabIndex        =   9
      Top             =   2880
      Width           =   1335
   End
   Begin VB.TextBox Text3 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   3120
      TabIndex        =   4
      Top             =   1080
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   1680
      TabIndex        =   3
      Top             =   1080
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   1080
      Width           =   1215
   End
   Begin VB.Label Label6 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   2280
      TabIndex        =   8
      Top             =   2160
      Width           =   2175
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   360
      TabIndex        =   7
      Top             =   2160
      Width           =   1455
   End
   Begin VB.Label Label4 
      Caption         =   "最小公倍数"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   2640
      TabIndex        =   6
      Top             =   1680
      Width           =   1455
   End
   Begin VB.Label Label3 
      Caption         =   "最大公约数"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   480
      TabIndex        =   5
      Top             =   1680
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "请输入三个正整数："
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   960
      TabIndex        =   1
      Top             =   600
      Width           =   2295
   End
   Begin VB.Label Label1 
      Caption         =   "求三个数的最大公约数和最小公倍数"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   360
      TabIndex        =   0
      Top             =   120
      Width           =   4215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
  Dim A, B, C, R, P, Q As Integer, S, S1 As Long
  A = Val(Text1.Text)
  B = Val(Text2.Text)
  C = Val(Text3.Text)
  Rem 求A和B的最大公约数Q1
  R = 1                               'R赋初值1
  While R <> 0
     P = Int(A / B): R = A - B * P      '求余数R
     If R <> 0 Then A = B: B = R      '如果余数R不为0，则产生新的A和B
  Wend
  Q = B                               'A和B的最大公约数赋Q
  Rem 求A和B的最小公倍数S1
  S1 = Val(Text1.Text) * Val(Text2.Text) / Q
  Rem 求Q1和C的最大公约数，即求A、B和C的最大公约数
  R = 1                                'R赋初值1
  While R <> 0
     P = Int(C / Q)                   '求余数R
R = C - Q * P
     If R <> 0 Then                    '如果余数R不为0，则产生新的C和Q
 C = Q: Q = R
       End If
  Wend
  Label5.Caption = Q                  '最大公因数赋标签Label5
  Rem 求S1和C的最小公倍数，即求A、B和C的最小公倍数
  S = S1
  R = 1                                 'R赋初值1
  While R <> 0
     P = Int(S1 / C):                   '求余数R
R = S1 - C * P
     If R <> 0 Then S1 = C: C = R      '如果余数R不为0，则产生新的S1和C
  Wend
  S = Val(S) * Val(Text3.Text) / C       '求三个数的最小公倍数
  Label6.Caption = S                   '最小公倍数赋标签Label6
End Sub
Private Sub Command2_Click()
  End
End Sub

