Best Answer

In a programming sense or a mathematical sense?

Mathematically, it is the same method as used to convert between any number bases:

Divide the number by the new base and note the remainder. Repeat with the quotient until it is zero. The number in the new base is the remainders in reverse order. For example, to convert the number 1234 in decimal (base 10) to hexadecimal (base 16):

1234 / 16 = 77 r2

77 / 16 = 4 r13

4 / 16 = 0 r 4

Number bases less than 10 use the same decimal digits, eg octal numbers (base 8) use the digits 0-7. For bases greater than 10, the convention is to use the alphabet to represent the extra digits, so base 11 would use 0-9,A, base 12 0-9, A-B, base 16 0-9, A-F, etc (where A would represent 1010, B represent 1110, etc).

so 123410 = 4D216.

Programmingwise, it would depend up on how your input number is stored, along with the language you're using. In C, for example, if you have an int containing number, it is actually effectively stored in binary and when printing it (converting to a string) it is converted to whatever the printf specification requests:

printf("%d = 0x%x", 1234, 1234);

would display

1234 = 0x4d2

The same specifications can be used on sprintf to store the result in memory.

If you are required to write the conversion, program the algorithm described in the mathematical method.

Q: How do you convert a number to hexadecimal form?

Write your answer...

Submit

Still have questions?

Continue Learning about Math & Arithmetic

117

NA

hex =7

1D.12516

The binary equivalent of the hexadecimal number EF16 is 1110111100010110.

Related questions

Write a program to convert a 2-digit BCD number into hexadecimal

117

WRITE A PROGRAM TO CONVERT A 2-DIGIT bcd NUMBER INTO HEXADECIMAL

The answer depends on what form you wish to convert binary and hex 2011 to.

Convert each group of 4 bits into one hexadecimal digit. 1010 is "A" in hexadecimal, so this particular number is "AA".

01

56704534

ABCD1 = 10101011110011010001

C65A = 143132

224 = E0

NA

1D.12516