0

hi friends,whats the output of the code and how you trace it?

https://code.sololearn.com/c9O8rCTshluq/?ref=app

20th Aug 2022, 10:32 PM
Nariman Tajari
Nariman Tajari - avatar
3 odpowiedzi
+ 5
> What is the output? You can fin it ou yourself if your run the code and check the console. > How does the output come to be like that? I think it gets clearer when you use the curly brackets on the if-statements: int i=3; if(!i) { i++; } i++; if(i==3) { i+=2; } i+=2;
20th Aug 2022, 10:41 PM
Lisa
Lisa - avatar
+ 2
Curly braces is used for multiline statements. If there is no curly braces it means only single statement would be there so if(!i) i++; i++; is like if (!i) i++; i++;
21st Aug 2022, 2:39 AM
A͢J
A͢J - avatar
+ 1
thanks Lisa , really illuminating.
20th Aug 2022, 10:43 PM
Nariman Tajari
Nariman Tajari - avatar