百度试题 题目2编写程序,求两个自然数m和n的最大公约数和最小公倍数。(用函数调用来 实现相关知识点: 试题来源: 解析反馈 收藏
用辗转相除法求两个自然数m,n的最大公约数和最小公倍数的vb程序编写 答案 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") n = InputBox("输入n") a = m b = n Do r = Abs(m - n) m = n ...
Integer,n As Integer Dim a As Integer,b As Integer Dim r As Integer m = InputBox("输入m")n = InputBox("输入n")a = m b = n Do r = Abs(m - n)m = n n = r Loop While m <> n Print a;"和";b;"最大公约数是";r Print a;"和";b;"最小公倍数是";a b ...