0

int a = 100 a = 50

I have a doubt that how the output is 50 not 100

8th Aug 2018, 5:16 PM
Malolan Aravamuthan
Malolan Aravamuthan - avatar
4 Answers
+ 3
int a = 10; a = 5; a=2; If a is now printed to screen , output will be 2 as you are reassigning value of a. Last value will be taken to consideration. Hope this helps â˜șâ˜ș.
8th Aug 2018, 5:24 PM
Meet Mehta
Meet Mehta - avatar
+ 4
= operator are use for assigning a value in a particular variable.. here you are reassign (a) variable value.. that's why you get 2
8th Aug 2018, 10:59 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
+ 2
When you assign 50 to the variable, the former value 100 is overwritten, so the value of a is 50.
8th Aug 2018, 5:21 PM
michal
0
thank you
8th Aug 2018, 5:22 PM
Malolan Aravamuthan
Malolan Aravamuthan - avatar