Skip to main contentSkip to solution

What would be the output of the following postfix expression?

20 50 3 6 + * * 300 / 2 –

Solution

✅ Correct Option: 3

A postfix expression is evaluated left to right. Operands are pushed onto a stack, and each operator is applied to the top two values, with the earlier value on the left.

3 6 +=3+6=93\ 6\ + = 3 + 6 = 9, so the stack is 20,50,920, 50, 9

50 9 ∗=45050\ 9\ * = 450, so the stack is 20,45020, 450

20 450 ∗=900020\ 450\ * = 9000

9000 300 /=309000\ 300\ / = 30

30 2 −=30−2=2830\ 2\ - = 30 - 2 = \boxed{28}

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question