Arithmetic operators are used to perform mathematic operations, here is the list of all C# arithmetic operators,
- "+" (Addition) – it is used to add two number, string concatenation
- "-" (Subtraction) – it is used to subtract second operand from first operand
- "*" (Multiplication) – it is used to multiply two operands
- "/" (Divide) – it is used to divide numerator from de-numerator
- "%" (Modulus) - it is used to get remainder
Example:
Input:
int a = 10;
int b = 3;
//operations
int sum = a + b;
int sub = a - b;
int mul = a * b;
float div = (float)a / (float)b;
int rem = a % b;
Output:
sum = 13
sub = 7
mul = 30
div = 3.333333
rem = 1
C# code to demonstrate example of arithmetic operators
Output