Browse Source

added function to ensure that the value of kgV is always positive

remotes/origin/kgV
cxnnqr 11 months ago
parent
commit
7cf436571f
  1. 5
      src/kgV/kgV.c

5
src/kgV/kgV.c

@ -1,7 +1,10 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include "ggT.h" #include "ggT.h"
int kgV(int a, int b){ int kgV(int a, int b){
if(a == 0 || b == 0) return 0; if(a == 0 || b == 0) return 0;
return a*b/ ggT(a, b);
int kgV = a*b/ ggT(a, b);
int absoluteKgV = abs(kgV);
return absoluteKgV;
} }
Loading…
Cancel
Save