An operand is just the term for a value which an operator is applied the priority for precedence for applies when an expression using these operators is evaluated is the same as you learned that is multiplication and divisions are executed before any addition or subtraction.
20 - 3 * 3 - 9/3
The above operations will produce the value 8 since it is equivalent to 20-9-3
You can also use parentheses in arithmetic calculations to change the sequence of operations expressions within the parentheses are always evaluated first starting with the innermost when they are nested so you use parentheses to override the default sequence of operations.Therefore the expression
(20 - 3) * (3 - 9)/3
is equivalent to 17*(-6)/3, which result in -34
Operator Description Example Result
- + Addition 5+2 7
- - Subtraction 5-2 3
- * Multiplication 5*2 10
- / Integer Division 5/2 2
- % Modulus 5%2 1
Enjoy........
No comments:
Post a Comment