Learn

We can convert hexadecimal to decimal in a similar way we converted binary to decimal, using the powers method. As a reminder, hexadecimal digits have 16 possible values, 0-9 and a-f.

A famous hexadecimal number in the early days of personal computers was 0xFF (one full byte). We convert it to decimal form this (remember to scroll tables):

power 1 0
value 16 1
number F F
decimal 15 15
product 240 15

Let’s multiply the value times the decimal number first:

1516+11515 \cdot 16 + 1 \cdot 15

Which gives us the values in the bottom row:

240+15=255240 + 15 = 255

in decimal.

Here is another example for 0xF891:

power 3 2 1 0
value 4096 256 16 1
number F 8 9 1
decimal 15 8 9 1
product 61440 2048 138 1

So, we multiplied decimal number times value:

409615+2568+169+114096 \cdot 15 + 256 \cdot 8 + 16 \cdot 9 + 1 \cdot 1

to get:

61440+2048+144+1=6363361440 + 2048 + 144 + 1 = 63633

in decimal as a result.

Instructions

1.

Use the power method to convert 0x19BCF to decimal.

Assign your answer to checkpoint_1 in the code editor.

2.

Use the power method to convert 0xBCE to decimal.

Assign your answer to checkpoint_2 in the code editor.

3.

Use the power method to convert 0x650 to decimal.

Assign your answer to checkpoint_3 in the code editor.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?