+ 2
Java
What is the output of this code? int result = 0; for (int i = 0; i < 5; i++) { if (i == 3) { result += 10; } else { result += i; } } System.out.println(result);
3 Respuestas
+ 16
Utkarsh Sharma
I guess this question is to ask how the output is 17 .
here , loop runs for 0,1,2,3,4
// ie result = result+ 0+1+2+10+4 = 17
//just add 10 in place of 3 bcz of condition
+ 7
SL has a Code Playground, you should write the code and try to practice!
You should check out what the output is!
Please, read our guidelines:
https://www.sololearn.com/discuss/1316935/?ref=app
+ 4
17