Private Sub Form_Click() Dim N As Integer, M As Integer, G As Integer N = InputBox("输入 N ") M = InputBox("输入 M ") G = Gcd(N, M) Print N; " 和 "; M; " 的最大公约数是:"; G End Sub Private Function Gcd(ByVal A As Integer, ByVal B As Integer) Dim R As Integer R = A Mod B Do While R <> 0 A = B B = R R = A Mod B Loop Gcd = B End Function
求最大公约数
最新推荐文章于 2022-07-10 20:23:23 发布