summaryrefslogtreecommitdiff
path: root/day1/exercise/gcd.py
diff options
context:
space:
mode:
Diffstat (limited to 'day1/exercise/gcd.py')
-rw-r--r--day1/exercise/gcd.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/day1/exercise/gcd.py b/day1/exercise/gcd.py
new file mode 100644
index 0000000..41db13d
--- /dev/null
+++ b/day1/exercise/gcd.py
@@ -0,0 +1,8 @@
+def gcd(a, b):
+ if a % b == 0:
+ return b
+ return gcd(b, a%b)
+
+print gcd(5, 40)
+print gcd(11, 60)
+