0
output
i dont understand how the output is 17....??? int result = 0; for (int i = 0; i < 5; i++) { if (i == 3) { result += 10; } else { result += i; } } System.out.println(result);
1 Antwort
+ 1
For i=0 result =0 than for i=1 result=0+1 than for i=2 result=1+2 than for i=3 result=3+10 than for i=4 result=13+4 than for i=5 loop breaks. Final result = 17