They convert the number to base 16. I tried putting them outside the if else but it still returns the same result. I also tried removing them and true it solves the problem with the second char its sometimes inaccurate for example if i enter 26 it outputs 1G, while according to a working calculator in my PC its real value is 1A. I'll try and rewrite it from scratch later
They convert the number to base 16. I tried putting them outside the if else but it still returns the same result.
By doing that you get rid of the information about all the other hex digits.
I also tried removing them
I believe that is the right thing to do.
the second char its sometimes inaccurate for example if i enter 26 it outputs 1G, while according to a working calculator in my PC its real value is 1A.
tpb has the solution to this problem (his second sentence).