Why the output its 5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why the output its 5

int b=6 int a=4 b=a++ Console.Writeline (++b)

14th Jul 2016, 9:16 AM
carlospercevallol
carlospercevallol - avatar
5 Answers
0
5
14th Jul 2016, 9:26 AM
santhosh
santhosh - avatar
0
b = a++; // Setting the value of b to 4 and then adds one to a. ++b // Adds one to b and then uses it.
14th Jul 2016, 10:03 AM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar
0
thanks ;)
14th Jul 2016, 11:02 AM
carlospercevallol
carlospercevallol - avatar
0
4 ki increment to 5
14th Jul 2016, 11:13 AM
santhosh
santhosh - avatar
0
first line: b = 6 second line: a = 4 third line: b = 4, a = 5 fourth line: b = 4+1, write b
17th Jul 2016, 6:22 PM
Genti Perja