Operator
Description
Example – given a is 15 and b is 6
+
Addition
a + b, would return 21
-
Subtraction
a - b, would return 9
*
Multiplication
a * b, would return 90
/
Division
a / b, would return 2
%
Modulus
a % b, would return 3 (the remainder)
As we saw in the preceding example there are particular symbols used to represent operators when performing calculations: Operator
Description
Example – given a is 15 and b is 6
+
Addition
a + b, would return 21
-
Subtraction
a - b, would return 9
*
Multiplication
a * b, would return 90
/
Division
a / b, would return 2
%
Modulus
a % b, would return 3 (the remainder)
Comentarios