# Operator precedence [duplicate]

Possible Duplicate:
What is 48÷2(9+3)?

Hi all

I don't know if anyone has seen this question floating around Facebook, but me and a friend are a little conflicted.

The question is: $6 \div 2(1+2) = ?$

Should this be interpreted as $\frac{6}{2(1+2)} = 1$, or $\frac{6}{2} \times (1+2) = 9$?

I went with the first, using programming operator precedence. My friend, however, went for the second, saying "In algebra, bracket multiplication binds more tightly than explicit multiplication".

What I'd like to know is, what is the answer to this simple equation in programming terms and algebra terms, or are they exactly the same?

Thanks very much,

James

-

## marked as duplicate by Hans Lundmark, Rahul, Guess who it is., t.b., Qiaochu YuanApr 29 '11 at 11:43

It should be interpreted as ambiguous and sent back for clarification. Whoever wrote it should write $(6\div2)(1+2)$ if that's what's meant, $6\div(2(1+2))$ if that's what's meant.