Skip to content

Instantly share code, notes, and snippets.

@ironbyte
Last active March 25, 2018 17:15
Show Gist options
  • Save ironbyte/e6ff774cf4d2aec480a831c5a244184f to your computer and use it in GitHub Desktop.
Save ironbyte/e6ff774cf4d2aec480a831c5a244184f to your computer and use it in GitHub Desktop.
GCD Finder
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