> 其他 >
vb用辗转相除法求两个自然数m,n的最大公约数和最小公倍数的程序代码如下,请完善之
用辗转相除法求两个自然数m,n的最大公约数和最小公倍数的程序代码如下,请完善之:
private sub command1_click()
dim m as integer,n as integer
dim a as integer,b as integer
dim r as integer
m = inputbox("输入m")
m = inputbox("输入n")
a=m
b=n
do
r=____
m=n
n=r
loop____
print a;"和"b;"最大公约数是";______
print a;"和"b;"最小公倍数是";______
end sub
人气:202 ℃ 时间:2020-03-26 15:28:49
解答
Private Sub command1_click()Dim m As Integer,n As IntegerDim a As Integer,b As IntegerDim r As Integerm = InputBox("输入m")n = InputBox("输入n")a = mb = nDor = Abs(m - n)m = nn = rLoop While m nPrint ...
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版