0% found this document useful (0 votes)
4 views4 pages

Comprog Activity

Operators in programming are symbols or keywords that perform operations on variables and values, essential for arithmetic, comparisons, and logical evaluations. The document outlines four types of operators: Arithmetic, Comparison, Logical, and Assignment, providing descriptions and examples for each. C++ code samples are included to illustrate the use of these operators.

Uploaded by

dieloolorga0111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Comprog Activity

Operators in programming are symbols or keywords that perform operations on variables and values, essential for arithmetic, comparisons, and logical evaluations. The document outlines four types of operators: Arithmetic, Comparison, Logical, and Assignment, providing descriptions and examples for each. C++ code samples are included to illustrate the use of these operators.

Uploaded by

dieloolorga0111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

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++:

You might also like