Denary to Hexadecimal Conversion
You can always check a denary to hexadecimal conversion by turning the answer back into denary. A two-digit hex number has place values of 16 and 1, so multiply the left digit by 16, add the right digit, and see whether the result matches the number you started with.
For example, if your answer for 173 is AD, change A back to 10, work out 10 × 16 = 160, then add D, which is 13: 160 + 13 = 173. This matches the original, so the conversion is correct.
Letters must be changed to 10 to 15 before you multiply. If you treat A as 1, or forget that it stands for 10, the check will not work. Never read a hex answer as though it were a denary number, and never assume a letter has no fixed value: A always means 10, B always means 11, and so on up to F for 15.
| Hex answer | Working backwards | Denary value |
|---|---|---|
| 5B | 5 × 16 + 11 | 91 |
| 0E | 0 × 16 + 14 | 14 |
A leading zero is still a character, so 0E is a valid two-digit answer and checks correctly to 14. Dropping it would break the rule that the answer is always two hex digits.
OCR GCSE Computer Science · Denary to Hexadecimal Conversion
OCR GCSE Computer Science · Hexadecimal to Denary Conversion