solve the given postfix expression 21-4+3*
Answers
Answer:
20 is the answer hope it help
Concept:
A postfix expression is where the operator is not between the two operands where it will operate, in a postfix expression the operator we put is after the two operands it has to perform.
For example, (2 1 - ), here ' - ' will operate on 2 and 1
Given:
A postfix expression 2 1 - 4 + 3 *
Find:
Solve the given postfix expression
Solution:
The postfix expression is 2 1 - 4 + 3 *
Now, we start from the leftmost operator which is ' - ' and it will operate on 2 and 1 so we will get,
(2 - 1)
= 1
Now, the expression is,
1 4 + 3 *
Again, operator ' + ' will operate on 1 and 4 we will get,
(1 + 4)
= 5
So now the expression is,
5 3 *
Finally, ' * ' will operate on 5 and 3 we will get,
(5 * 3)
= 15
Final answer:
By solving the given postfix expression we get 15 as our final answer.
#SPJ2