Precedence
When an expression has two or more operators, we need to identify the correct sequence to evaluate these operators. This is because result of the expression changes depending on the precedence. Precedence is the condition that specifies the importance of each operator relative to the other.
Example
Consider a mathematical expression : 10+5/5
When the given expression is evaluated left to right, the final answer becomes 3. However if the expression is evaluated right to left, the final answer becomes 11. This shows that changing the sequence in which the operators are evaluated in the given expression also changes the solution.
Operator precedence from lower precedence to higher
No comments:
Post a Comment