dec2hex

Purpose:

Convert a decimal number to its hexadecimal equivalent with an option for zero-padded output and output its binary representation.

Enter:

dec2hex <number> [z]

Where:

number Specify the decimal number to convert.
z Optional. Specify this option to pad the hexadecimal output to at least 4 digits.

Example:

dec2hex 1027
Convert to hex equivalent using minimum number of digits.

dec2hex 255 z
Convert to 4-digit hex equivalent padded with zero(s) if necessary.

Notes:

The program outputs the binary representation of the number after the hexadecimal conversion.

See Also: