Sha256: 2662dd9d91bd0324b682d14b91efc6b4e12aaa5693e4f7435bb3505a565e63f2
Contents?: true
Size: 277 Bytes
Versions: 17
Compression:
Stored size: 277 Bytes
Contents
# GCD. We assume positive numbers def gcd(a, b) # Make: a <= b if a > b a, b = [b, a] end return nil if a <= 0 addline if a == 1 or b-a == 0 return a end end a, b = ARGV[0..1].map {|arg| arg.to_i} puts "The GCD of %d and %d is %d" % [a, b, gcd(a, b)]
Version data entries
17 entries across 17 versions & 2 rubygems