+ 1

do my math wrong.

x = 34 y = ++x z = y++ print Y print Z the answers are? my thought Y = 35 // Z = 35

21st Oct 2016, 12:19 PM
INyoman Arisudewa
INyoman Arisudewa - avatar
6 odpowiedzi
+ 3
Y is 36, Z is 35.
21st Oct 2016, 1:02 PM
Zen
Zen - avatar
+ 1
zen is right if we avoid variable case sensitivity.., can we really avoid case sensitivity??
21st Oct 2016, 1:33 PM
chandra grg
chandra grg - avatar
+ 1
Good point, chandra, variable names are case-sensitive.
21st Oct 2016, 2:21 PM
Zen
Zen - avatar
0
y = 35 z= 35
29th Oct 2016, 8:05 AM
Sanjeet Kumar
Sanjeet Kumar - avatar
- 2
Y is 35 but Z should be 36 .. its beacause .. in the 2nd statement Y becomes 35 n then in third statement first the value of 35 is taken as y and then 1 I incremented I.e. 35+1=36 which the computer stores in its memory. Next, when Print statement takes place then the computer gives 35 as the value of y n 36 as tha value of Z as 36 was stored in the memory.
21st Oct 2016, 12:53 PM
Pragya Sagar
Pragya Sagar - avatar
- 2
this is a really chill society
7th Nov 2016, 3:42 PM
Daniel Torres Mathieutwo
Daniel Torres Mathieutwo - avatar