Last active
March 25, 2018 17:15
-
-
Save ironbyte/e6ff774cf4d2aec480a831c5a244184f to your computer and use it in GitHub Desktop.
GCD Finder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gcd(n, m) | |
if (n > m) && (n * m > 0) | |
r = n % m | |
if r == 0 | |
return m | |
else | |
return gcd(m, r) | |
end | |
end | |
end | |
puts gcd(54, 16) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment