+ 1

Help with something Java related

Hi, I was solving a quiz in Sololearn when I came across this code. I couldn’t figure out the output for this code , I mean I couldn’t figure out how that output came.

7th Apr 2018, 2:25 PM
Alex Snyder
Alex Snyder - avatar
3 Answers
+ 7
Looks like you'll get help from this thread: https://www.sololearn.com/Discuss/1018292/help-with-code
7th Apr 2018, 2:52 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 1
Thanks
7th Apr 2018, 3:08 PM
Alex Snyder
Alex Snyder - avatar
0
int result=0 for(int i=0; i<5; i++) { if(i==3) { result +=10; } else result +=i; } System.out.print(result);
7th Apr 2018, 2:28 PM
Alex Snyder
Alex Snyder - avatar