diff options
Diffstat (limited to 'algorithms/ggT.c')
-rw-r--r-- | algorithms/ggT.c | 20 |
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; +} + |