08 Programming Foundations - Octal

Download as pdf or txt
Download as pdf or txt
You are on page 1of 37

Mohammed Abu-Hadhoud

ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations

What is
Octal System?

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Counting Systems?

Decimal System (Base 10) Binary System (Base 2)

Hexadecimal System (Base 16)


7 6 5 4 3 2 1 0

7 6 5 4 3 2 1 0

Octal System (Base 8)


Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
The Octal Numbering System is very similar in principle to the previous
hexadecimal numbering system except that in Octal,

Each octal digit represents 3 bits, so a 6-bit byte is two octal digits

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
ASCII Table

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Why Octal?
• Previously in old computers the byte was only 6 digits not 8 digits.
• In octal a binary number is divided up into groups of only 3 bits,
with each group or set of bits having a distinct value of between
000 and 111.
• The use of octal numbers has declined now, why?!

Because most modern computers (use Nibbles) no longer base their word length on
multiples of three bits, (they are based on multiples of four bits, so hexadecimal is
more widely used).

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
It’s hard for human to read binary!
What does this mean?
01001001 00100000 01001100 01101111 01110110 01100101
00100000 01011001 01101111 01110101 00100001

I Love You!

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Both Hexadecimal and Octal Systems
Provides a human-friendly representation

11010100 D4 Hexa

11010100 212 Octal

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations

Octal Prefix

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Prefix:
Hexa Prefix:
Technology/Language Prefix Example
HTML & CSS #Code #FFFFFF
C,C++,Java..etc 0x Code 0x725
XML &#Code &#C2A4
Unicode U+Code U+C2A4

Octal Prefix:

0oCode  0o725
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations

How Octal works?

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Remember that binary was base 2.

27 26 25 24 23 22 21 20 Base 2

128 64 32 16 8 4 2 1 Doubling

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Hexadecimal is base 16.

164 163 162 161 160 Base 16

65536 4096 256 16 1

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Octal System is base 8.

84 83 82 81 80 Base 8

4k 512 64 8 1

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations

Convert Decimal to Octal

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
conversion from decimal to octal and
binary to octal

Follows the same pattern as we have seen


previously for hexadecimal

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Convert 469 to Octal
Number / 8 Result Integer Fraction Remainder Octal

469 / 8 = 58.625 58 0.625 8 x 0.625 = 5 5

58 / 8 = 7.25 7 0.25 8 x 0.25 = 2 2

7/8 = -- -- -- 7 7

469 10 725 8

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations

Convert Oct to Decimal.

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Convert Octal 725 to Decimal
82 81 80

725
5 x 80 = 5 x 1 = 5+
2 x 81 = 2 x 8 = 16 +
7 x 82 = 7 x 64 = 448
469

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations

Convert Octal to Binary.

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Way 1:

How to Convert Octal to Binary?


• Two steps:
1. Convert octal to decimal.
2. Convert decimal to binary.

That’s it.

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Way 2:

How to Convert Octal to Binary?

Direct Conversion.

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Direct Conversion:

Convert Octal 725 to Binary


725

7 2 5

111 010 101

Only 3 digits
not Nibble
111 010 101
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations

Convert Binary to Oct.

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Way 1:

How to Convert Binary to Octal?


• Two steps:
1. Convert Binary to Decimal.
2. Convert Decimal to Octal.

That’s it.

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Way 2:

How to Convert Binary to Octal?

Direct Conversion.

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Convert 000111010101 to Octal

111 010 101

111 010 101

7 2 5

72 5
ProgrammingAdvices.com
Mohammed Abu-Hadhoud
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
1- Convert those Octal numbers to Decimal:

• 100
• 512

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
2- Convert those Decimal numbers to Octal:

• 64
• 330

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
2- Convert (direct) those Octal numbers to Binary :

• 100
• 512

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
3- Convert (direct) those Binary numbers to Octal :

• 0100 0000
• 0001 0100 1010

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Solution

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Solutions:
1:
• 100  64
• 512  330

2:
• 64  100
• 330  512

3:
• 100  0100 0000
• 512  0001 0100 1010

4:
• 0100 0000  100
• 0001 0100 1010  512

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Thank you 
124 150 141 156 153 040 131 157 165 040 072 055 051 015 012

Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy