Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gcd with ruby
def mygcd(n, m)
return n if m.zero?
mygcd(m, n % m)
end
puts mygcd(ARGV[0].to_i, ARGV[1].to_i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.