Skip to content

Instantly share code, notes, and snippets.

@s-tammy-kato
Created April 16, 2019 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s-tammy-kato/0101438f23f3efe8f11e89ebce4f94e7 to your computer and use it in GitHub Desktop.
Save s-tammy-kato/0101438f23f3efe8f11e89ebce4f94e7 to your computer and use it in GitHub Desktop.
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