day1/exercise/gcd_another.py
author Nishanth Amuluru <nishanth@fossee.in>
Tue, 14 Dec 2010 23:12:25 +0530
branchscipyin2010
changeset 455 84b7a3f4a15a
parent 64 333092b68926
permissions -rw-r--r--
updated the checklist to suit new circulate

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)