Skip to content

Instantly share code, notes, and snippets.

@st98
Created December 17, 2013 16:19
Show Gist options
  • Save st98/8007640 to your computer and use it in GitHub Desktop.
Save st98/8007640 to your computer and use it in GitHub Desktop.
Rubyの練習。2つの整数の最小公倍数を求めます。
def gcd(a, b)
if b == 0 then
a
else
gcd(b, a % b)
end
end
def lcm(a, b)
a * b / gcd(a, b)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment