From e91518495c7ea3f0d8a0d345fdeb6d35a15990cc Mon Sep 17 00:00:00 2001 From: CodenameREBIRTH Date: Wed, 7 Oct 2020 14:05:11 +0530 Subject: [PATCH] added algorithm section --- algorithms/gcd.py | 4 ++++ algorithms/lcm.py | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 algorithms/gcd.py create mode 100644 algorithms/lcm.py diff --git a/algorithms/gcd.py b/algorithms/gcd.py new file mode 100644 index 0000000..b9cae45 --- /dev/null +++ b/algorithms/gcd.py @@ -0,0 +1,4 @@ +def gcd(a,b): + if b == 0: + return a + return gcd(b,a%b) \ No newline at end of file diff --git a/algorithms/lcm.py b/algorithms/lcm.py new file mode 100644 index 0000000..488fce7 --- /dev/null +++ b/algorithms/lcm.py @@ -0,0 +1,2 @@ +def lcm(a,b): + return a/gcd(a,b)*b \ No newline at end of file