用VB编一求两数m,n最大公约数的函数过程f(m,n);主调程序在两个文本框接收输入数据,在图形框显示结果

来源:百度知道 编辑:UC知道 时间:2024/06/05 15:15:40
快啊!!

Dim Z As Integer
Private Sub Form_Click()
Dim A As String, B As String
Form1.Cls
Form1.AutoRedraw = True
A = Val(text1.text)
B = Val(text2.text)
If A > B Then Call Zd(A, B) Else Call Zd(B, A)
picture1.Print a;"和";b;"的最大公因数是:";Z
End Sub
Private Sub Zd(ByVal X As Integer, ByVal Y As Integer)
Dim T As Integer
If X Mod Y = 0 Then
Z = Y
Else
Call Zd(Y, X Mod Y)
End If
End Sub

已经运行过。