From 8bb76200ce7372631e3c1449d0a9ce5f668b333a Mon Sep 17 00:00:00 2001 From: cxnnqr Date: Thu, 1 Feb 2024 22:42:55 +0100 Subject: [PATCH] implemented basic function for the ggT --- src/ggT/ggT.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ggT/ggT.c b/src/ggT/ggT.c index ca3f5be..484acb6 100644 --- a/src/ggT/ggT.c +++ b/src/ggT/ggT.c @@ -1,4 +1,13 @@ #include -int ggT(int a, int b); \ No newline at end of file +int ggT(int a, int b){ + while(a != b){ + if(a < b){ + b -= a; + } else { + a -= b; + } + } + return a; +} \ No newline at end of file