- 3

What is the output of this code

lnt result=0; for (int i=0; i<5;I++) ( (if(I==3)( result+=10;) else(result +=I;) ) system. out.println(result);

8th Apr 2017, 5:35 PM
costantine chola
costantine chola - avatar
2 Answers
+ 6
That's not Javascript friend. Did you mean Java? Syntax error 😔 Mixing Parenthesis with curly braces. l is undefined.
8th Apr 2017, 6:03 PM
Wisdom Abioye
Wisdom Abioye - avatar
+ 4
syntax error if you think about it i dont even think thats javascript. java has system.out but if we ignore all that.... first loop (i = 0): result = 1 second loop (i = 1): result = 2 third loop (i = 2): result = 3 fourth loop (i = 3): result = 13 fifth loop (i = 4): result = 14
8th Apr 2017, 5:40 PM
Edward