|
@ -2,16 +2,16 @@ |
|
|
#include <stdlib.h> |
|
|
#include <stdlib.h> |
|
|
#include "ggT.h" |
|
|
#include "ggT.h" |
|
|
|
|
|
|
|
|
int kgV(int a, int b){ |
|
|
|
|
|
|
|
|
int kgV(int fistNumber, int secondNumber){ |
|
|
|
|
|
|
|
|
// Case for at least one number is Zero |
|
|
// Case for at least one number is Zero |
|
|
if(a == 0 || b == 0) return 0; |
|
|
|
|
|
|
|
|
if(fistNumber == 0 || secondNumber == 0) return 0; |
|
|
|
|
|
|
|
|
// Regular case of calculating the kgV |
|
|
// Regular case of calculating the kgV |
|
|
int kgV = a*b/ ggT(a, b); |
|
|
|
|
|
|
|
|
int kgVResult = fistNumber*secondNumber/ ggT(fistNumber, secondNumber); |
|
|
|
|
|
|
|
|
// Getting the absolute value of the kgV |
|
|
// Getting the absolute value of the kgV |
|
|
int absoluteKgV = abs(kgV); |
|
|
|
|
|
|
|
|
int absoluteKgV = abs(kgVResult); |
|
|
|
|
|
|
|
|
return absoluteKgV; |
|
|
return absoluteKgV; |
|
|
} |
|
|
} |