Olorga, Ullyzes Zabdiel BSIT-NS-1A May 13, 2025
Computer Programming 3 Activity
What are Operators in programming?
Operators are special symbols or keywords used to perform operations on
variables and values. They are the building blocks for performing tasks such as arithmetic
calculations, comparisons, and logical evaluations.
Types of operators:
1. Arithmetic Operators:
Used to perform basic mathematic operations.
Operator Description Example
+ Addition 5 + 3 = 8
- Subtraction 10 - 4 = 6
* Multiplication 6 * 7 = 42
/ Division 8 / 2 = 4
% Modulus (remainder) 10 % 3 = 1
Sample in C++:
2. Comparison Operators:
Used to compare two values.
Operator Description Example
== Equal to 5 == 5 → True
!= Not equal to 4 != 2 → True
> Greater than 7 > 3 → True
< Less than 2 < 6 → True
>= Greater than or equal 5 >= 5 → True
<= Less than or equal 4 <= 9 → True
Sample in C++:
3. Logical Operators:
Used to combine conditions.
Operator Description Example
&& AND true && false → false
! NOT !true → false
Sample in C++:
4. Assignment Operators:
Used to assign values to variables.
Operator Description Example
= Assign x = 10
+= Add and assign x += 2 (x = x + 2)
-= Subtract and assign x -= 1 (x = x - 1)
Sample in C++: