Академический Документы
Профессиональный Документы
Культура Документы
W24 CCS0023
1. Arithmetic Operators: this type of operator are used to perform simple mathematical
operations such as Addition (+), Subtraction(-), Multiplication(*), Division(/), and
Modulus (%)
Example:
Output:
2. Unary Operators: these are operators that manipulates a single value and these
includes:
Example:
Output:
3. Assignment Operators: this operator assigns a value to the left operand with based on
the value of the right operand and is done using an equal (=) sign. The following are the
types of an assignment operator.
Ouput:
4. Relational Operators: these operators are used to check the equality of operands as
well as compare two or more values.
Example:
Output:
5. Logical Operators: these operators are also known as Boolean operators due the fact
that they return Boolean values, true or false.
Example:
Output:
6. Ternary Operator: this operator is a shorthand version of if-else statements and is done
by using the syntax: condition?value1: value2. Where first value i.e. value1 executes if
the condition is true and if the condition is false value2 executes.
Example:
Output:
7. Bitwise Operators: Bitwise operators are used to perform operations on single bitwise
values. First, it converts the numerical value to its binary representation and then it
performs the necessary operation and gives the result.
Example:
Output:
8. Shift Operators: The bitwise shift operators take two operands: the first is a quantity to
be shifted, and the second specifies the number of bit positions by which the first
operand is to be shifted. The direction of the shift operation is controlled by the
operator used. Shift operators convert their operands to 32 or 64 bits and return a
result of the same type as the left operator.
Example:
Output: