what is the output of this code? int a = 4; int b = 6; b = a++; console.writeline(++b); _ pls help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

what is the output of this code? int a = 4; int b = 6; b = a++; console.writeline(++b); _ pls help me

10th Aug 2016, 12:24 PM
Yasin Demirci
Yasin Demirci - avatar
17 Answers
+ 4
5
10th Aug 2016, 12:28 PM
Amol Tembhukar
Amol Tembhukar - avatar
+ 2
5 answer
10th Aug 2016, 9:36 PM
ikram khan
ikram khan - avatar
+ 2
5
11th Aug 2016, 5:01 PM
Asha Kiran B
+ 2
5 and just after those commands the var b will contain 6 because the ++ working after the command ...
21st Aug 2016, 2:41 PM
avy7352
avy7352 - avatar
+ 2
in my last comment here was a mistake the answer is 5 of course, because when you put ++ before the var name the program adding 1 to the var and than copying the value to b but if you put it after a like a++ the program first applying the value to b and after that adding 1... hope I'm helped...
22nd Aug 2016, 6:40 AM
avy7352
avy7352 - avatar
+ 1
it's 5
10th Aug 2016, 12:33 PM
Piyush Kumbhojkar
Piyush Kumbhojkar - avatar
+ 1
Yes it is 5
11th Aug 2016, 5:07 PM
Rami Salim
Rami Salim - avatar
0
5
12th Aug 2016, 10:58 AM
CH.Durga Prasanna Kumar
CH.Durga Prasanna Kumar - avatar
0
5
21st Nov 2016, 6:34 PM
Dilshad Ahmad
Dilshad Ahmad - avatar
0
5
18th May 2017, 6:07 PM
Dilshad Ahmad
Dilshad Ahmad - avatar
0
5
10th Aug 2018, 9:13 AM
KRISHNA VENI S CSE
KRISHNA VENI S CSE - avatar
- 3
it was don't
10th Aug 2016, 12:34 PM
Yasin Demirci
Yasin Demirci - avatar
- 3
6
13th Aug 2016, 2:55 PM
Jack
Jack - avatar
- 5
sorry this answer correct
10th Aug 2016, 12:36 PM
Yasin Demirci
Yasin Demirci - avatar
- 6
6 its the answer
11th Aug 2016, 12:03 PM
KushindaLOL
KushindaLOL - avatar
- 7
The out put it will be 7
11th Aug 2016, 7:21 AM
Rami Salim
Rami Salim - avatar
- 7
7 is it correct
11th Aug 2016, 7:21 AM
Rami Salim
Rami Salim - avatar