Operators allow us to perform various operations on operands. There are various operators in C# to perform different types of operations.
1. Arithmetic Operators:
These are mathematical operators used on operands. Examples include:
Addition (+): adds two operands (e.g. x + y)
Subtraction (-): subtracts the second operand from the first (e.g. x – y)
Multiplication (*): multiplies two operands (e.g. x * y)
Division (/): divides the first operand by the second (e.g. x / y)
Modulus (%): returns the remainder when dividing the first operand by the second (e.g. x % y)
2. Relational Operators:
Comparison operators are used to compare values and return a boolean result. Some common operators include equality (==), inequality (!=), greater than (>), less than (<), greater than or equal to (>=), and less than or equal to (<=).