📄 最大公约数.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text2
Height = 390
Left = 3000
TabIndex = 5
Top = 1800
Width = 735
End
Begin VB.TextBox Text1
Height = 375
Left = 960
TabIndex = 4
Top = 1800
Width = 735
End
Begin VB.CommandButton CmdCalcu
Caption = "运行"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1440
TabIndex = 0
Top = 2400
Width = 1695
End
Begin VB.Label Label3
Caption = "N="
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 3
Top = 1800
Width = 615
End
Begin VB.Label Label2
Caption = "M="
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 2
Top = 1800
Width = 615
End
Begin VB.Label Label1
Caption = "求自然数m,n的最大公约数和最小公倍数"
Height = 375
Left = 600
TabIndex = 1
Top = 1080
Width = 3495
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdCalcu_Click()
Dim m As Integer
Dim n As Integer
m = Text1
n = Text2
If n <= 0 Or m <= 0 Then
Print "数据出错"
'End
End If
mn = m * n
If m < n Then t = m: m = n: n = t
Do While (n <> 0)
r = m Mod n
m = n
n = r
Loop
Print
Print
Print "最大公约数=", m,
Print "最小公倍数=", mn / m
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -