Convert from Decimal to Hexadecimal

Convert from Decimal to Hexadecimal

The convertion from decimal to hexadecimal can be achived through recursivly dividing the decimal value through 16. Then the integer result of each devision is written down from left to right and the reminder is divided again through 16 until the reminder is zero.

Example: 77 => hexadecimal
77 / 16^1 = 4 (first hex digit)
77 % 16^1 = 13
13 / 16^0 = 13 (=d, second hex digit)
13 % 16^0 = 0
=> 0x4d (= 77)