Encoding Schemes and Number System
Decimal to other number systems
Convert a decimal number by repeated division.
To convert a decimal number to another base, use repeated division:
- Step 1: divide the number by the new base.
- Step 2: note the remainder.
- Step 3: keep dividing each quotient by the base, noting each remainder, until the quotient becomes 0.
- Step 4: write the remainders in reverse order, from the last (bottom) to the first (top).
Decimal to binary (divide by 2). Convert 45: 45 ÷ 2 = 22 r 1; 22 ÷ 2 = 11 r 0; 11 ÷ 2 = 5 r 1; 5 ÷ 2 = 2 r 1; 2 ÷ 2 = 1 r 0; 1 ÷ 2 = 0 r 1. Reading from bottom to top: (45)₁₀ = (101101)₂.
Decimal to octal (divide by 8). 45 ÷ 8 = 5 r 5; 5 ÷ 8 = 0 r 5. So (45)₁₀ = (55)₈.
Decimal to hexadecimal (divide by 16). Remainders from 10 to 15 are written as the letters A to F. 45 ÷ 16 = 2 r 13 (D); 2 ÷ 16 = 0 r 2. So (45)₁₀ = (2D)₁₆. Another: 200 ÷ 16 = 12 r 8; 12 ÷ 16 = 0 r 12 (C). So (200)₁₀ = (C8)₁₆.
A note on the book: in Figure 2.7, the remainders for 65 in hexadecimal are 1 and then 4, so reading from bottom to top gives (41)₁₆; the figure misprints it as (14)₁₆.
Practise this lesson
Questions that get harder as you improve, a Tutor that helps without giving the answer away, and progress you can see. Free for every learner.
No account, no email address. Opens the real product.