changeset 64 | 333092b68926 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/day1/exercise/gcd_another.py Thu Oct 08 18:59:47 2009 +0530 @@ -0,0 +1,13 @@ +def gcd(a, b): + if a - b == 0: + return b + if a > b: + return gcd(b, a-b) + else: + return gcd(b, b-a) + +def lcm(a, b): + return (a * b) / gcd(a, b) + +print lcm(21, 14) +