Yes, you are right, answer is "1 3 5". Theinitial value of the i variable is 1. and each step it is incremented by 2, so it will
be (2n+1) on the nth step. So loop will just print odd numbers: 1, 3, 5, 7, 9...But there is condition "if (i % 5 = 0)" that holds when i = 0, 5,
10, 15.... So the first value at which the condition is met will be 5, and an
indication "break" will stop the loop.
Comments
Leave a comment