- 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);
2 Answers
+ 6
That's not Javascript friend. Did you mean Java?
Syntax error đ
Mixing Parenthesis with curly braces.
l is undefined.
+ 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