CS255 Syllabus
Octal Numbers
• Octal number system: number system based on number 8

• Has 8 digits: 0, 1, 2, 3, 4, 5, 6, 7
• Value of digits increase by 8 for each position
```   Example:

153(8) = 1 x 82 + 5 x 81 + 3 x 80
= 64 + 40 + 3 = 107
```

• Finding the representation of a value in the octal number system:

• Divide the value repeated by 8
• Collect the remainders in the reverse order

(The procedure is exactly the same as the one to find the representation for a value in the binary number system, except you need to divide by 8 instead of 2)

``` Example:

value = 23

Find the representation in the octal number system:

23
8 ------ 7
2
8 ------ 2
0

representation is ----> 27(8)
```
• Octal numbers are mainly used to show binary code because octal number can be converted easily to binary numbers and vice versa.

• Converting octal numbers to binary numbers:

• Convert each octal digit to 3 binary digits using:
```      Octal digit       Binary digits
-----------       -------------
0      -->         000
1      -->         001
2      -->         010
3      -->         011
4      -->         100
5      -->         101
6      -->         110
7      -->         111

Example:

153(8) = 01101011(2)
```

• Converting binary numbers to octal numbers:

• Convert (starting from the right) each group of 3 binary digits into one octal digit using:
```      Binary digits     Octal digit
-------------     -----------
000       -->      0
001       -->      1
010       -->      2
011       -->      3
100       -->      4
101       -->      5
110       -->      6
111       -->      7

Example:

11111101(2) = 375(8)
```