asked 78.9k views
5 votes
Explain why A*B*C and (A*B)*C are not same

asked
User Mr Wil
by
7.7k points

1 Answer

4 votes
The difference is in the operator precedence (order of operations) in both expressions. The result of the expression is evaluated on the basis of the different order. In the first expression, b * c is evaluated firstly, and in the second expression, the brackets facilitate the sum of a and b, followed by the multiplication by c. For example, if a = 2, b = 3, c = 4, the expressions will be evaluated as follows:

a + b*c = 2 + 3*4 = 2 + 12 = 14

(a + b) * c = (2 + 3) * 4 = 5 * 4 = 20
answered
User Diamante
by
8.3k points

No related questions found

Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.