C
Programming and Technical
Programming
Program
integer x = 40, y = 35, z = 20, w = 10;
Comment about the output of the following two statements:
print x * y / z - w
print x * y / (z - w)
1) Differ by 80
2) Same
3) Differ by 50
4) Differ by 160
Read Solution (Total 5)
-
- a .differ by 80
because of Precedence
in first print first calculate x*y=a then a/z=b then b-w
but in 2nd print first calculate x*y=A then z-w=B then A/B because () have high precedence then other operator in the statement - 9 years agoHelpfull: Yes(6) No(1)
- differ by 80
- 9 years agoHelpfull: Yes(2) No(1)
- Differ by 80
- 9 years agoHelpfull: Yes(0) No(0)
- x * y / z - w gives 60
x * y / (z - w) gives 140
so differ by 80 - 9 years agoHelpfull: Yes(0) No(0)
- differ by 80
- 8 years agoHelpfull: Yes(0) No(0)
C Other Question