101. Convert Integer to Hex String Without sprintf or itoa functions

In embedded systems, you may need to transmit an integer value as a hexadecimal string over UART, display, or logs — but without using heavy standard functions like sprintf() or itoa().

Your task is to:

  • Read an unsigned 16-bit integer num
  • Print its hexadecimal string representation in uppercase
  • Do not use any built-in conversion functions like itoa(), sprintf(), etc.


Example-1

Input: 255
Output: FF


Example-2

Input: 4095
Output: FFF


Example-3

Input: 0
Output: 0


Example-4

Input: 4660
Output: 1234


 

Loading...

Input

255

Expected Output

FF