+ 2

Help

Why the output of x is 17 instead of 18

31st Jul 2023, 1:57 PM
Jyoti
Jyoti - avatar
7 Respuestas
+ 7
Jyoti , That is because the x value is 7 ...as you given already... That 7 is applied to the next statement where and all you put x... https://code.sololearn.com/cPs07tSFJwap/?ref=app In this code I give the x in seperate Line now it will give 18... hope you understood
31st Jul 2023, 2:20 PM
Riya
Riya - avatar
+ 4
Because x is still 7 and when you say x + 10 , it becomes 17
1st Aug 2023, 10:32 AM
Amir Zamani
Amir Zamani - avatar
+ 4
Jyoti , TYPE:- 1 For example lemme take, x=5 x=x+1 ---->here it becomes (5+1)=6 z=x+1----->here now it will take the x value which is previous to it.and not the very first value....so (6+1)=7 TYPE:-2 x=5 z=x+1, x Here x=5 is applied to the entire line...
1st Aug 2023, 4:02 PM
Riya
Riya - avatar
+ 1
@riya but xis first x+1 then it became 8 and then x= x+10 then the output should be 18
1st Aug 2023, 3:02 PM
Jyoti
Jyoti - avatar
0
Riya ok thanks
2nd Aug 2023, 10:19 AM
Jyoti
Jyoti - avatar
0
Amir Zamani Ok thanks
2nd Aug 2023, 10:19 AM
Jyoti
Jyoti - avatar