Interview Question
Country: India
Interview Type: Written Test
c=((a)+(b)*(a*b-a))-((b-a*a)*(b)+(a));
c =((2)+(3)*(2*3-2))-((3-2*2)*(3)+(2))
c=((2)+(3)*(4))-((-1)*(3)+(2))
c=((2)+12)-(-3+(2))
c=14-(-1)=15
SUM(X,Y) (X*Y) just means (x*y) and that is why the difference when applied by reverse, there are no brackets for x and y like ((x)*(y)) and MULT(X,Y) (X)+(Y) just adds x and y after calculating them. You should know that macro only replaces the code with the thing we tell it to replace it with. Its not a function which will calculate a value and return a solution which will takes its place. So simply replace your code with what is written in the macro exactly and the calculate
c=((a)+(b)*(a*b-a))-((b-a*a)*(b)+(a));
- Anonymous September 15, 2012Yeah this is the answer... it is 15