Computer Science, asked by rky99314, 10 months ago

why do we apply
precedence
rule ?​

Answers

Answered by saihemap
0

Answer

&

Explanation:

In mathematics and computer programming, the order of operations (or operator precedence) is a collection of rules that reflect conventions about which procedures to perform first in order to evaluate a given mathematical expression.

For example, in mathematics and most computer languages, multiplication is granted a higher precedence than addition, and it has been this way since the introduction of modern algebraic notation.[1][2] Thus, the expression 2 + 3 × 4 is interpreted to have the value 2 + (3 × 4) = 14, not (2 + 3) × 4 = 20. With the introduction of exponents in the 16th and 17th centuries, they were given precedence over both addition and multiplication and could be placed only as a superscript to the right of their base.[1] Thus 3 + 52 = 28 and 3 × 52 = 75.

These conventions exist to eliminate ambiguity while allowing notation to be as brief as possible. Where it is desired to override the precedence conventions, or even simply to emphasize them, parentheses ( ) can indicate an alternative order or reinforce the default order to avoid confusion. For example, (2 + 3) × 4 = 20 forces addition to precede multiplication, and (3 + 5)2 = 64 forces addition to precede exponentiation. Sometimes, for clarity, especially with nested parentheses, the parentheses are replace by brackets, as in [2×(3+4)]-5=9.

Hope it will helps you mark as BRAINLIST

Similar questions