# C# - operators

Operators perform an operation between the operands, this operation can be mathematical, logical, or bitwise.

## arithmetic operators

are used to perform mathematical operations. the following are basic operations between the arithmetic operators:

## C#

``````8 + 12        // 20
100 - 2        // 98
5 * 5          // 25
(float)50 / i         // 2.5
70 / 8       // 8
70 % 8         // 6
``````

## logical

three or four logical operations are available, exactly how much it depends on the particular programming language that we use. with these operations, we can solve any logical task or condition. these logical conditions are for example connections of comparing values according to certain rules, testing values. logical operations are mainly used in the execution of conditional statements.

## C#

``````a && b
a || true
!a``````

## bitwise

we have more of the bitwise operators, using the bitwise operator we can set or determine the specific bit in whole numbers.

## C#

``````2 << 2
2 >> 2
0xff & 0x05 // 0x05
0x01 | 0x02 // 0x03
~ 2
0x1A ^ 0x1A ``````

## relational

the main use of the relational operators is in control of conditional statements. thanks to these, we can decide which direction to continue the conditional statements, or for example, how many iterations of the cycle need to perform.

## C#

``````5 < 3        //   true
x > 3.14     //
y <= x       //   ...
0xff >= y    //   ...
x == 6
y != 25      ``````

## C#

Other pieces of example codes:
`2 >> 2`
`(10 - j * 0.5)`
`a || true`
`x = 95 + 5`
`x = 16 << 2`
`y != 25`
operators in another programming language:
Languages: en hu cz sk