From a96a8759116f0cfbd1be52840c41662518578427 Mon Sep 17 00:00:00 2001 From: Laurin Date: Fri, 2 Feb 2024 15:23:08 +0100 Subject: [PATCH] added other cases for input being smaller than 16 --- src/conversionOfNumbers/conversionOfNumbers.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conversionOfNumbers/conversionOfNumbers.c b/src/conversionOfNumbers/conversionOfNumbers.c index 6c9708c..6a92ed7 100644 --- a/src/conversionOfNumbers/conversionOfNumbers.c +++ b/src/conversionOfNumbers/conversionOfNumbers.c @@ -60,6 +60,12 @@ char* convertIntToHex(int input){ rest = input % 16; input /= 16; switch(rest){ + case 10: result[length - 1] = 'A'; break; + case 11: result[length - 1] = 'B'; break; + case 12: result[length - 1] = 'C'; break; + case 13: result[length - 1] = 'D'; break; + case 14: result[length - 1] = 'E'; break; + case 15: result[length - 1] = 'F'; break; default: result[length - 1] = rest + '0'; break; } length--;