18 Programming Foundations - Bitwise Operators
18 Programming Foundations - Bitwise Operators
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
Operators
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Operator Types
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations
Mathematical
Operators
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Mathematical Operators
Operator Computer Symbol Example
Operation Results
Addition + 3.0 + 4.2 7.2
Multiplication * 5*5 25
Integer Division / 10 / 5 2
Power ^ 3^2 9
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations
Relational Operators
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Relational Operators
Operator Computer Symbol Example
Operation Results
Equal to
= 5=7 False
Less than
< 5<7 True
Grater than
> 5>7 False
Not equal to
<> 5 <> 7 True
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations
Logical Operators
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Computer Foundations
Logic in Marriage
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Logic in
Marriage Life
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Logical Operators
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
“AND”
Operators
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Logical Operators
Operator Computer Symbol Example
Operation Results
And
AND True AND True True
Or
OR True OR False True
Not
NOT NOT True False
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Logical Operators
True 1
(5 > 3) True
False 0
(5 > 7) False
(5 > 3) AND (5>7) False
True False 0
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Practical Example to learn “AND” operator:
IF you wan to get hired you have to have all the following
conditions:
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Logical “AND” Operator:
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
AND Any “False” in AND the
result is False
A B A AND B
1 1 1
A B A AND B 1 0 0
0 1 0
True True True
0 0 0
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
“OR”
Operators
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Logical “NOT” Operators
True 1
(5 > 3) True
False 0
(5 > 7) False
(5 > 3) OR (5>7) True
True False 0
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Practical Example to learn “OR” operator:
IF you wan to get hired you have to have at least One the
following conditions:
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Logical “OR” Operator:
Condition A Condition B A OR B
Age Has Driver License
25 >= 21 True Yes True True
25 >= 21 True No False True
19 >= 21 False Yes True True
19 >= 21 False No False False
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
OR Any “True” in OR the
result is True
A B A OR B
1 1 1
A B A OR B 1 0 1
0 1 1
True True True
0 0 0
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
“NOT”
Operators
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Logical “NOT” Operator:
Condition A NOT A
True False
False True
Mohammed Abu-Hadhoud
ProgrammingAdvices.com
MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
Copyright© 2022 26+ years of experience
Logical “NOT” Operators
True 1
NOT (5 > 3) False
False 0
1
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
Solve the following problems:
12 >=12 NOT (12 >=12) 1 AND 1 (7 = 7) and (7 > 5)
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