Browse Source

added other cases for input being smaller than 16

remotes/origin/conversionOfNumbers
Laurin 11 months ago
parent
commit
a96a875911
  1. 6
      src/conversionOfNumbers/conversionOfNumbers.c

6
src/conversionOfNumbers/conversionOfNumbers.c

@ -60,6 +60,12 @@ char* convertIntToHex(int input){
rest = input % 16; rest = input % 16;
input /= 16; input /= 16;
switch(rest){ 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; default: result[length - 1] = rest + '0'; break;
} }
length--; length--;

Loading…
Cancel
Save