aboutsummaryrefslogtreecommitdiff
path: root/week10/ex1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'week10/ex1.cpp')
-rw-r--r--week10/ex1.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/week10/ex1.cpp b/week10/ex1.cpp
new file mode 100644
index 0000000..9467043
--- /dev/null
+++ b/week10/ex1.cpp
@@ -0,0 +1,13 @@
+#include <iostream>
+
+int gcd(int a, int b) {
+ if (a == b) return a;
+ if (a > b) return gcd(a-b, b);
+ return gcd(b, a);
+}
+
+int main() {
+ int a, b;
+ std::cin >> a >> b;
+ std::cout << gcd(a, b) << std::endl;
+}