tags:

views:

119

answers:

3

How can I write this statement:

9-3/(1+2)

... from infix to postfix?

+2  A: 

9 3 1 2 + / - (and more stuff to make 15 characters)

Richard Pennington
+2  A: 

You can use the Shunting-yard algorithm to convert from infix to postfix notation.

Tom Rudick
+4  A: 

9-3/(1+2)

First would be (1+2) since it has the highest order of operation.

-> 1 2 +

Then 3 divided by the result...

-> 3 1 2 + /

Then 9 minus the result....

-> 9 3 1 2 + / -
Craig