If you try to represent this in LaTeX you end up with this:
\frac {6} {2(2+1)}
which AFAIK is like: (6)/(2(2+1))
If you write it as this:
\frac 6 2(2+1)
LaTeX gives you this:
C and its derivative languages (Java, Python, PHP etc) will work it out (with a multiplication added) to be 9. To get 1 you have to start piling on brackets to force the order of operations to change.