day1/exercise/gcd_another.py
author Puneeth Chaganti <punchagan@fossee.in>
Sun, 10 Jan 2010 18:10:31 +0530
changeset 350 385b9df26f25
parent 64 333092b68926
permissions -rw-r--r--
Added first-cut makefiles.

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)