← Control Flow

Skip and Stop

hard

Loop from 1 to n, applying two different kinds of early exit: continue past any multiple of 3 (it’s skipped, but the loop keeps going), and break out of the loop entirely the moment i exceeds 15 (nothing from that point on gets printed, or even checked).

Trace the n = 20 case by hand before running it: multiples of 3 up through 14 get skipped one at a time as the loop continues normally, but the moment i reaches 16, the loop stops completely – 17 through 20 are never printed, and never even reach the multiple-of-3 check, because break exits before either happens.

Your solution

"Run" uses the sample stdin ("10"). "Submit" checks your code against all 3 test cases.

Test results

Submit your solution to run it against all test cases.

Hints

    Reference solution