+ 1

What is the output of this code?

Question from challenges: int a=1; for(int i=0; i<20 ; i++){ a++; } cout<<a;

1st Dec 2017, 8:11 AM
Iron-man
Iron-man - avatar
4 Answers
+ 7
21
1st Dec 2017, 8:27 AM
Programmer Jr.
Programmer Jr. - avatar
+ 6
21 because the loop runs 20 times and increments a 20 times in which a already has a value of 1 soo..1+....20=21
1st Dec 2017, 8:32 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 1
thks 👍
1st Dec 2017, 10:22 AM
Iron-man
Iron-man - avatar