greatest_common_divisor_1.sf 156 B

123456789101112
  1. #!/usr/bin/ruby
  2. #
  3. ## https://rosettacode.org/wiki/Greatest_common_divisor
  4. #
  5. func gcd(a, b) {
  6. b.is_zero ? a.abs : gcd(b, a % b);
  7. }
  8. say gcd(90, 24);