Arrays Module 3 Quiz | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Arrays Module 3 Quiz

I am learning Java and I don't understand the answer/output for the 2nd question. Below is the question. The answer/output is 17. I don't understand why it is "17". The hint provided the answer and not an actual hint. Can someone explain why the answer is "17"? Maybe I am overthinking this. Thanks :) 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);

22nd Oct 2018, 5:47 AM
Georgia
Georgia - avatar
1 Answer
0
Thanks sooo much Gordie :0)
23rd Oct 2018, 4:14 AM
Georgia
Georgia - avatar