diff --git a/src/conversionOfNumbers/conversionOfNumbers.c b/src/conversionOfNumbers/conversionOfNumbers.c index 4c97fbf..6c9708c 100644 --- a/src/conversionOfNumbers/conversionOfNumbers.c +++ b/src/conversionOfNumbers/conversionOfNumbers.c @@ -49,4 +49,20 @@ unsigned int convertBinaryStrToInt(char* input){ x++; } return result; +} + +char* convertIntToHex(int input){ + int length = 1; + int rest; + char* result = (char*)malloc(sizeof(char) * length + 1); + result[length] = '\0'; + do{ + rest = input % 16; + input /= 16; + switch(rest){ + default: result[length - 1] = rest + '0'; break; + } + length--; + }while(input != 0); + return result; } \ No newline at end of file