vb用辗转相除法求两个自然数m,n的最大公约数和最小公倍数的程序代码如下,请完善之用辗转相除法求两个自然数m,n的最大公约数和最小公倍数的程序代码如下,请完善之:private sub command1_click()dim m as integer,n as integerdim a as integer,b as integerdim r as integer m = inputbox("输入m")m = inputbox("输入n")a=mb=ndor=____m=nn=rloop____print a;"和"b;"最大公约数是";______print a;"和"b;"最小公倍数是";______end sub
问题描述:
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
答
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 ...