Description: Find the biggest common factor of two integers
B4X:
Sub gcd( a As Int, b As Int) As Int
If b > a Then
Dim t As Int = a
a = b
b = t
End If
Dim m As Int
Do While b <> 0
m = a Mod b
a = b
b = m
Loop
Return a
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.