convert decimal 1024 to hexadecimal

8.2k Views Asked by At

I need to convert the decimal number 1024 to an hexadecimal number, I do this using these steps http://www.wikihow.com/Convert-from-Decimal-to-Hexadecimal#steps

However, whenever I divide 1024 by 16 I get as result the integer 64, now I'm kind of stuck as how to continue from here since every step from hereon onwards will just be an endless loop (*16, /16, *16, etc).

My math is really bad so a detailed explanation would be greatly appreciated!

2

There are 2 best solutions below

0
On BEST ANSWER

Using the first procedure: 1024 / 16 = 64, exactly, so no remainder. So we write a 0.

64 / 16 = 4, no remainder, so we write a 0.

4 / 16 = 0, remainder 4, so we have (the digits in reverse order, as said:) 1024 (decimal) = 400 in hexadecimal.

0
On

I think you may have misread the step-by-step solution that you gave as a link. Remark that: $\frac{1024}{16} = 64 \Rightarrow \frac{64}{16} = 4$. If you try to divide 4 by 16 you you get a 'remainder' of 4. You did two divisions so you shift the 4 over 2 indices (as in, you get the remainder 4, and because you divided your original number twice before you got a remainder $\neq 0$), your remainder 4 becomes 400 (again, the two zeros being the result of the two divisions). This 400 is the hexademical representation of the number 1024 in decimal representation.

Keep in mind that the reason you're dividing your original number by 16 is because you're transforming that number into 'base' 16. In other words, if you have a number $x*y*z$ in hexademical notation, this is equivalent to $16^{2}*x + 16*y + 16^{0}*z$ in decimal notation. I hope that makes sense.