【VB开源代码栏目提醒】:网学会员为广大网友收集整理了,6.3.3.frm,希望对大家有所帮助!
VERSION 5.00
Begin VB.Form Form4
Caption = "Form4"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form4"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 1680
TabIndex = 0
Top = 1080
Width = 1215
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Function gcd(x As Integer, y As Integer) As Integer
Do While y <> 0
reminder = x Mod y
x = y
y = reminder
Loop
gcd = x
End Function
Private Sub Command1_Click()
Dim a As Integer, b As Integer
Dim c As Integer, d As Integer
Dim result As Integer, result2 As Integer
a = Val(InputBox("请输入第一个数"))
b = Val(InputBox("请输入第二个数"))
c = a
'保留初始值用于求最小公倍数
d = b
result = gcd(a, b)
'调用Function过程
result2 = (c * d) / result
MsgBox "最大公约数是" & result
MsgBox "最小公倍数是" & result2
End Sub
上一篇:
6.3.2.frm
下一篇:
促进教育公平 构建和谐社会