Hi!all
Im having a diffucult time to spot the error on the below codes to find the GCD of the two integer numbers.Please help me to debug
Private Sub cmdgcd_Click()
Dim A As Integer, B As Integer, D As Integer
A = InputBox("A = ?")
B = InputBox("B = ?")
D = GCD(A, B)
MsgBox ("The GCD of " & A & " and " & B & " is " & D)
End Sub
Function GCD(ByVal X As Integer, ByVal Y As Integer) As Integer
Dim R As Integer
Do While Y > 0
R = X Mod Y
X = Y
Y = R
Loop
End Function
Thanx alot