Hi
The output is 5.
The process goes like this:
++i+i*j-j*i
++4+4*7-7*4
the process os divided now in three parts
++4 + 4*7 - 7*4
5 + 28 - 28
So answer is 5...how come it is -2 ? Check it out again please...
Hi all,
The output is -3 :) well so many ppl are coming up with so many ans so execution of code is must before someone tries to ans it... :)
based on precedence ++ then * and then + -
so now the equation will be
i++ first.
Now in equation replace i++ as 4
4 +i*j-j*i
but since it is a post increment i value will be refleceted only after an operation.
so that operation is i*j = 4 * 7 =28
then the value of i is visible as 5
so the next operation is j * i = 7 * 5 = 35
here i is 5 since a single operation 4*7 occured before it.
now the whole equation becomes.
4 + 28 - 35 = -3
Hope all are happy with ans.... if some one is not satisfied then they can execute the code in a turbo c complier and verify the result.
let me know on how it helped to geek491@yahoo.co.in
thanks..bye