DATA STRUCTURE
Programming and Technical
Programming
Technical
Given Integer x = 40, y = 35, z = 20, w = 10
Comment on the output of the following two statements
print x * y / z - w print x * y / (z - w)
Read Solution (Total 10)
-
- x * y / z - w = 60
x * y / (z - w) =140
so the comment will be both outputs are differ by 80 - 6 years agoHelpfull: Yes(4) No(0)
- first print will be - 35*40/20-10
1st priority '/', 2nd '*',3rd '-'
so ans will be= 35*2-10=70-10=60
------------------------------------------------------
second print will be - 35*40/(20-10)
1st priority '/', 2nd '*',3rd '-'
so ans will be= 35*40/10=140 - 6 years agoHelpfull: Yes(3) No(1)
- x= 40, y=35, z=20, w=10
print x*y/z-w
40*35/20-10
40*1-10
40-10 = 30
--------------------------------
print x*y/(z-w)
40*35/(20-10)
40*35/10
40*3 = 120 - 6 years agoHelpfull: Yes(1) No(2)
- by using bodmas rule
we get 40*35/20-10 =60
40*35/(20-10) = 4*35 =>140 - 6 years agoHelpfull: Yes(1) No(0)
- 50 and 150
- 6 years agoHelpfull: Yes(0) No(2)
- 60 and 140
- 6 years agoHelpfull: Yes(0) No(0)
- 60 and 140
- 6 years agoHelpfull: Yes(0) No(0)
- 1. 60
2. 140
According bodmas rule - 5 years agoHelpfull: Yes(0) No(0)
- 60 and 140
- 5 years agoHelpfull: Yes(0) No(0)
- x*y/z-w=40*35/20-10
=> 1400/20-10=70-10=60
x*y/(z-w)=40*35/(20-10)
=> 1400/10=140 - 5 years agoHelpfull: Yes(0) No(0)
DATA STRUCTURE Other Question