The equivalent infix expression and value for the postfix form 1 2 + 3 * 4 5 * – will be ___________

The equivalent infix expression and value for the postfix form 1 2 + 3 * 4 5 * – will be ___________
A. 1 + 2 * 3 – 4 * 5 and -13
B. (2 + 1) * (3 – 4) * 5 and 13
C. 1 + 2 * (3 – 4) * 5 and -11
D. (1 + 2) * 3 – (4 * 5) and -11
 
Answer: d
Explanation: Given postfix expression : 1 2 + 3 * 4 5 * –
⇒ (1 + 2) 3 * 4 5 * –
⇒ ((1 + 2) * 3) 4 5 * –
⇒ ((1 + 2) * 3) (4 * 5) –
⇒ ((1 + 2) * 3) – (4 * 5)
So, the equivalent infix expression is (1 + 2) * 3 – (4 * 5) and it’s value is -11.
 

Tìm kiếm

Back
Top