Super Annoying Prefix

Convert to Infix and solve: + / ^ - 1 4 2 / - 5 3 2 % 9 4


The answer is 10.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

(1-4)^2/(5-3)/2+(9%4) (-3^2)/(2/2)+1 (9/1)+1 9+1 10

Use the VLR method to infix it all and inset parenthesis as needed: ((1-4)^2)/((5-3)/2)+(9%4)

ans. is 10

dhruvisha brahmbhatt - 7 years, 2 months ago
Vaibhav Zambad
Mar 21, 2014

For the given expression ,the required infix expression is ((1-4)^2)/((5-3)/2)+(9%4) =10 from the following algo:-

1.The reversed input string is completely pushed into a stack. prefixToInfix(stack) 2.IF stack is not empty a. Temp -->pop the stack b. IF temp is a operator Write a opening parenthesis to output prefixToInfix(stack) Write temp to output prefixToInfix(stack) Write a closing parenthesis to output c. ELSE IF temp is a space -->prefixToInfix(stack) d. ELSE Write temp to output IF stack.top NOT EQUAL to space -->prefixToInfix(stack)
so , the answer to it is 10

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...