求教用VB 写程序.求两自然数m,n的最小公倍数.这样写对吗?Dim a%,b%,t%,i%a=inputbox(“第1个数”):b=inputbox(“第2个数”)If a
问题描述:
求教用VB 写程序.求两自然数m,n的最小公倍数.这样写对吗?
Dim a%,b%,t%,i%
a=inputbox(“第1个数”):b=inputbox(“第2个数”)
If a
答
给你另外一种求法Dim a As LongDim b As LongDim t As Longa = 42b = 30t = aDim result As Longresult = 1For i = 1 To t If (a Mod i) = 0 And (b Mod i) = 0 Then a = a / i b = b / i r...