Operations In Computer
Operators in Computers: Math, Relational, and Logic
Operators are the symbols that tell the computer what action to perform on data.
In this lesson you’ll learn the three core families you’ll use everywhere:
- Mathematical operators (e.g.,
+,-,*,/,Mod,^) - Relational operators (e.g.,
=,<,>,<=,>=,<>) - Logical operators (e.g.,
AND,OR,NOT)
You’ll also see truth tables, how computers view True = 1 and False = 0, and realistic decision examples.
1️⃣ Operator Types
- Mathematical: arithmetic on numbers
- Relational: compare two values → returns True/False
- Logical: combine/negate conditions (True/False)
2️⃣ Mathematical Operators
3️⃣ Relational Operators (comparisons return True/False)
4️⃣ Logical Operators (work on True/False)
Logic in marriage
Your wife is always right no matter what, and you are always wrong :-)
Logic in computer
5️⃣ From Real Life to Computer Logic
The slides illustrate logic with everyday statements (“logic in marriage/life”) and then map that to computer-style logic with AND / OR / NOT. This helps you see how conditions become code decisions.
Practical AND example (hiring rule):
“You must meet both conditions to be hired:
- Age ≥ 21 AND Has a driver license.
Computer form:(Age >= 21) AND (HasDriverLicense = True)
A single False in AND → result False (not hired).
Practical OR example (hiring rule):
“You must meet at least one:
- Age ≥ 21 OR Has a driver license.”
Computer form:(Age >= 21) OR (HasDriverLicense = True)
Any True in OR → result True (hired).
6️⃣ AND Operator
7️⃣ OR Operator
7️⃣ NOT Operator
Practical Example:
I want to hire only Males , so you can say in computer:
- If Male then hire
- or you can use Not: If not (Female) then hire. because not female means male
🔗 Interconnection
- Math operators compute values; Relational compare values; Logical combine decisions.
- Computers evaluate conditions as True/False (i.e., 1/0) and use AND/OR/NOT to decide flow.
- Real policies (like hiring rules) translate directly into logical expressions you can code.
By mastering these, you’ll express real-world rules precisely and build reliable decisions in programs. 🚀
15 Programming Foundations - Operators In Computer.pdf















0 comments