Evaluate the postfix expressions using stacks
12 14 + 12 / 12 14 *
12 14 + 12 / 12 14 *
Push 12
12 |
Stack
12 14 + 12 / 12 14 *
Push 14
14 |
12 |
Stack
12 14 + 12 / 12 14 *
Pop 14 and 12 apply operator +
12 + 14 = 26, push 26 into the stack
26 |
Stack
12 14 + 12 / 12 14 *
Push 12
12 |
26 |
Stack
12 14 + 12 / 12 14 *
Pop 12 and 26 apply operator /
26 / 12 = 2.167, push 2.167 into the stack
Push 2.167
2.167 |
Stack
12 14 + 12 / 12 14 *
Push 12
12 |
2.167 |
Stack
12 14 + 12 / 12 14 *
Push 14
14 |
12 |
2.167 |
Stack
12 14 + 12 / 12 14 *
Pop 14 and 12 apply operator *
12 * 14 = 168, push 168 into the stack
Push 168
168 |
2.167 |
Top of the stack is 168 So result is 168
Result: 168
Get Answers For Free
Most questions answered within 1 hours.