Browse Source

refactoring: use ggT function from previous instead of new one

remotes/origin/kgV
cxnnqr 11 months ago
parent
commit
77b6fbc704
  1. 15
      src/kgV/kgV.c

15
src/kgV/kgV.c

@ -1,18 +1,5 @@
#include <stdio.h> #include <stdio.h>
int ggT(int a, int b){
// handles the zero cases
if(a == 0) return b;
if(b == 0) return a;
// Euclidean algorithm with modulo for getting the ggT
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
return a;
}
#include "ggT.h"
int kgV(int a, int b){ int kgV(int a, int b){
return a*b/ ggT(a, b); return a*b/ ggT(a, b);
Loading…
Cancel
Save