Browse Source

refactoring: changed to Euclidean modulo algorithm

remotes/origin/ggT
cxnnqr 11 months ago
parent
commit
1fdc737367
  1. 10
      src/ggT/ggT.c

10
src/ggT/ggT.c

@ -2,12 +2,10 @@
int ggT(int a, int b){
while(a != b){
if(a < b){
b -= a;
} else {
a -= b;
}
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
return a;
}
Loading…
Cancel
Save