Skip to content

Instantly share code, notes, and snippets.

@enile8
Last active December 10, 2015 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enile8/4480899 to your computer and use it in GitHub Desktop.
Save enile8/4480899 to your computer and use it in GitHub Desktop.
Finding the lowest common multiple with python
def gcd(arg1, arg2):
while arg2 > 0: arg1,arg2 = arg2, arg1 % arg2
return arg1
def contest1(arg1, arg2):
result = arg1 * arg2 / gcd(arg1,arg2)
return result
num1 = int(raw_input('Enter the first number:\n'))
num2 = int(raw_input('Enter the second number:\n'))
print 'the lcm is %s '% contest1(num1, num2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment