BASICON
2nd Term, SY 2002-2003
Number System
• The radix or base defines the number of symbols needed to represent all possible numbers in
the number system.
Number System Base Symbols
Decimal 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Binary 2 0, 1
Octal 8 0, 1, 2, 3, 4, 5, 6, 7
Hexadecimal 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Number System Conversion
A. Decimal ⇔ Binary
To convert decimal number to binary, continually divide the number by 2 until the quotient is
zero. The remainders give the binary representation of the number in reverse order.
Example: 1410 = 11102
Remainder
2 ) 14 0
2 ) 7 1
2 ) 3 1
2 ) 1 1
0
To convert binary number to decimal, multiply the binary digits by the correct power of 2 and
sum them.
Example: 11102 = 1410
11102 = 1 x 23 + 1 x 22 + 1 x 21 + 0 x 20
=1x8+1x4+1x2+0x1
=8+4+2
= 1410
B. Decimal ⇔ Octal
To convert decimal number to octal, continually divide the number by 8 until the quotient is
zero. The remainders give the octal representation of the number in reverse order.
Example: 2310 = 278
Remainder
8 ) 23 7
8 ) 2 2
0
To convert octal number to decimal, multiply the octal digits by the correct power of 8 and
sum them.
Page 1 of 5
BASICON
2nd Term, SY 2002-2003
Example: 278 = 2310
278 = 2 x 81 + 7 x 80
=2x8+7x1
= 16 + 7
= 2310
C. Decimal ⇔ Hexadecimal
To convert decimal number to hexadecimal, continually divide the number by 16 until the
quotient is zero. The remainders give the hexadecimal representation of the number in
reverse order.
Example: 4610 = 2E16
Remainder
16 ) 46 14 = E
16 ) 2 2
0
To convert hexadecimal number to decimal, multiply the hexadecimal digits by the correct
power of 16 and sum them.
Example: 2E16 = 4610
2E16 = 2 x 161 + 14 x 160
= 2 x 16 + 14 x 1
= 32 + 14
= 4610
D. Binary ⇔ Octal
To convert binary number to octal, binary digits are grouped into threes starting from the
right hand end of the bit pattern and padding the leftmost group with zeros to make a pattern
of three (if necessary). Each group of three is coded as a single octal digit similar to
converting 3 binary digits to decimal.
Example: 110102 = 328
011 010
3 2
To convert octal number to binary, each octal digit is expanded into the equivalent 3 binary
digits.
Example: 328 = 011 0102
3 2
011 010
Page 2 of 5
BASICON
2nd Term, SY 2002-2003
E. Binary ⇔ Hexadecimal
To convert binary number to hexadecimal, binary digits are grouped into fours starting from
the right hand end of the bit pattern and padding the leftmost group with zeros to make a
pattern of four (if necessary). Each group of four is coded as a single hexadecimal digit
similar to converting 4 binary digits to decimal.
Example: 1010102 = 2A16
0010 1010
2 10 (A)
To convert hexadecimal number to binary, each hexadecimal digit is expanded into the
equivalent 4 binary digits.
Example: 2A16 = 0010 10102
2 A
0010 1010
Binary Arithmetic
Addition Rules: Subtraction Rules:
0+0=0 0–0=0
0+1=1 0 – 1 = 1 borrow 2
1+0=1 1–0=1
1 + 1 = 0 carry 1 1–1=0
Multiplication Rules: Division Rules:
0x0=0 0 ÷ 0 = undefined
0x1=0 0÷1=0
1x0=0 1 ÷ 0 = undefined
1x1=1 1÷1=1
Example: Binary Addition
1 1 0 0
+ ) 1 1 0 1 0
1 0 1 1 0
Example: Binary Subtraction
0 2
1 1 0 0
- ) 1 0 1 0
0 0 1 0
Page 3 of 5
BASICON
2nd Term, SY 2002-2003
Example: Binary Multiplication
1 1 0 0
X ) 1 0 1 0
0 0 0 0
1 1 0 0
0 0 0 0
1 1 0 0
1 1 1 1 0 0 0
Example: Binary Division
1 1 r. 1
1 0 ) 1 1 1
1 0 ↓
1 1
1 0
1
Octal Arithmetic
Example: Octal Addition
1
3 5
+ ) 1 4 6
1 0 3
Example: Octal Subtraction
0 10 13
1 3 5
- ) 4 6
6 7
Example: Octal Multiplication
2 3
X ) 1 5
10 15
2 3
2 13 15
1 1
3 6 7
Page 4 of 5
BASICON
2nd Term, SY 2002-2003
Hexadecimal Arithmetic
Example: Hexadecimal Addition
1
2 A
+ ) 1 E E
1 1 8
Example: Hexadecimal Subtraction
0 18 21
1 3 5
- ) 5 D
D 8
Example: Hexadecimal Multiplication
2 3
X ) 3 5
10 15
6 9
6 19 15
1
7 3 F
Page 5 of 5