1.3.10 How to Use Math Operators

Math operators in C# are very much the same as they are in the real world with only a few exceptions.


Operator Purpose
+ adds values together
* multiplies values
/ divides values
% gets the remainder of a number after division
++ increases a value by 1
-- decreases a value by 1

C# also has relational operators that are used to compare values.


Operator Purpose
< less than
> greater than
<= less than or equal to
>= greater than or equal to
== the same as
!= not the same