Skip to content

Instantly share code, notes, and snippets.

@thinkphp

thinkphp/input.rb

Created Nov 12, 2020
Embed
What would you like to do?
def euclid_it a, b
while b != 0
r = a % b
a, b = b, r
end
a
end
def euclid_rec a, b
if b == 0
a
else
euclid_rec(b, a % b)
end
end
def main
#print "a = "
#a = gets.to_i
#print "b = "
#b = gets.to_i
#c = euclid_rec(a,b)
#print c
a = ARGV[0].to_i
b = ARGV[1].to_i
c = euclid_rec(a,b)
p c
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment