'功能:将两个数约分
'版本:V1.0
Dim a1, b1, a, b, i, p
a1 = InputBox("请输入第一个数字","比值化简工具(例:1080:2340)")
b1 = InputBox("请输入第二个数字","比值化简工具(例:1080:2340)")
If a1 > b1 Then max = a1 Else max = b1
If max <> 0 Then
a = a1: b = b1
For p = 1 To max
For i = 2 To max
If a Mod i = 0 And b Mod i = 0 Then a = a / i: b = b / i
Next
Next
MsgBox ("化简结果:" & a1 & ":" & b1 & " = " & a & ":" & b)
Else
MsgBox ("至少一个数不为0!")
End If
这个程序不能计算小数的比值,