Sha256: 9905011e0ac22bcc88263c895f041d637b42f39561798da30a7e0dfb0900bddb

Contents?: true

Size: 184 Bytes

Versions: 26

Compression:

Stored size: 184 Bytes

Contents

# Greatest common divisor of a and b
def gcd a, b
  x = [a,b].max
  y = [a,b].min

  while y != 0
    r = x % y
    x = y
    y = r
  end

  x
end

puts gcd ARGV[0].to_i, ARGV[1].to_i

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/byebug-2.7.0/test/examples/gcd.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/byebug-2.7.0/test/examples/gcd.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/byebug-2.7.0/test/examples/gcd.rb
byebug-3.0.0 test/examples/gcd.rb
byebug-2.7.0 test/examples/gcd.rb
byebug-2.6.0 test/examples/gcd.rb
byebug-2.5.0 test/examples/gcd.rb
byebug-2.4.1 test/examples/gcd.rb
byebug-2.4.0 test/examples/gcd.rb
byebug-2.3.1 test/examples/gcd.rb
byebug-2.3.0 test/examples/gcd.rb
byebug-2.2.2 old_doc/gcd.rb
byebug-2.2.1 old_doc/gcd.rb
byebug-2.2.0 old_doc/gcd.rb
byebug-2.1.1 old_doc/gcd.rb
byebug-2.1.0 old_doc/gcd.rb
byebug-2.0.0 old_doc/gcd.rb
byebug-1.8.2 old_doc/gcd.rb
byebug-1.8.1 old_doc/gcd.rb
byebug-1.8.0 old_doc/gcd.rb