summaryrefslogtreecommitdiff
path: root/algorithms/ggT.c
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-15 03:24:33 +0200
committerPatrick Simianer <p@simianer.de>2014-06-15 03:24:33 +0200
commitcf3a29feb5887344b6633ead1b4b6d5657a15a4b (patch)
treef1149508f7305a48dba0226699dfafdd68d81969 /algorithms/ggT.c
parent5ddc763ab9953eebdaf78af4eb72288d7955b310 (diff)
old stuff: algorithms
Diffstat (limited to 'algorithms/ggT.c')
-rw-r--r--algorithms/ggT.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/algorithms/ggT.c b/algorithms/ggT.c
new file mode 100644
index 0000000..0b0b75e
--- /dev/null
+++ b/algorithms/ggT.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+
+unsigned int
+ggT(unsigned int a, unsigned int b)
+{
+ if (b==0) {
+ return a;
+ } else {
+ return ggT(b, a%b);
+ }
+}
+
+int main(void)
+{
+ printf("%d\n", ggT(24, 4));
+
+ return 0;
+}
+