4,273 views
0 votes
0 votes
If y is of integer type then the below expression 3*(y-8) / 9 and (y-8) / 9*3

 

a) must yield different value

B)Must yield same value

c) may or may not yield same value

D) none of the above

1 Answer

Best answer
1 votes
1 votes
* and / are left to right associative which means if operand is surrounded by * and * or * and / or / and * or / and / first we will evaluate the one on the left side and then we go on to solve to right side, so a*b/c is equivalent to (a*b)/c and a/b*c is (a/b)*c.

Take and example where y=0 both give different value first one gives -2 as answer and other gives 0 as answer so answer is option (C).

Related questions