From 7cf436571ff31d519e2f9545a64e3e0bb60dfee0 Mon Sep 17 00:00:00 2001 From: cxnnqr Date: Tue, 6 Feb 2024 12:40:46 +0100 Subject: [PATCH] added function to ensure that the value of kgV is always positive --- src/kgV/kgV.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kgV/kgV.c b/src/kgV/kgV.c index 2821d84..e050d06 100644 --- a/src/kgV/kgV.c +++ b/src/kgV/kgV.c @@ -1,7 +1,10 @@ #include +#include #include "ggT.h" int kgV(int a, int b){ 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; } \ No newline at end of file