summaryrefslogtreecommitdiff
path: root/AlgoDesignAndTechniqueEdxPython/sources
diff options
context:
space:
mode:
Diffstat (limited to 'AlgoDesignAndTechniqueEdxPython/sources')
-rw-r--r--AlgoDesignAndTechniqueEdxPython/sources/gcdlcm.py (renamed from AlgoDesignAndTechniqueEdxPython/sources/gcd.py)5
1 files changed, 4 insertions, 1 deletions
diff --git a/AlgoDesignAndTechniqueEdxPython/sources/gcd.py b/AlgoDesignAndTechniqueEdxPython/sources/gcdlcm.py
index 7b107cd..57b48ff 100644
--- a/AlgoDesignAndTechniqueEdxPython/sources/gcd.py
+++ b/AlgoDesignAndTechniqueEdxPython/sources/gcdlcm.py
@@ -10,10 +10,13 @@ def getGCD(a, b):
else:
return getGCD(b, a % b)
+def getLCM(a, b):
+# https://www.idomaths.com/hcflcm.php#formula
+ return a * b // getGCD(a, b)
if __name__ == '__main__':
entryNumbers = sys.stdin.read()
tokens = entryNumbers.split()
a = int(tokens[0])
b = int(tokens[1])
- print(getGCD(a, b))
+ print(getLCM(a, b)) \ No newline at end of file