Search code examples
stringintegerpseudocode

print hexadecimal representation of an int


i am looking for a pseudocode that prints the hexadecimal represenation of an integer as string.

thanks!


Solution

    • Take the remainder of the integer modulo 16
    • Convert the remainder to a hex digit
    • Place the hex digit into the left-most position in the output string
    • Divide the integer by 16
    • Repeat the above until the value is zero