Mar 27, 2014 SubName: gcd Author: Euclid 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 Tags: Euclid, Common Denominator Click to expand...
SubName: gcd Author: Euclid 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 Tags: Euclid, Common Denominator