Skip Multiples of 3
Completed
Read n and print numbers from 1 to n on one line, skipping multiples of 3. Use continue.
Input
One integer.
Output
One line of numbers separated by spaces.
Example
Input
10
Output
1 2 4 5 7 8 10
Editor
Python
Hints
continue jumps straight to the next loop iteration.
print(i, end=" ") keeps everything on one line.
Solution explanation
continue skips the rest of the current iteration. Trailing spaces are ignored by the checker, so end=" " is fine.
Show solution
n = int(input())
for i in range(1, n + 1):
if i % 3 == 0:
continue
print(i, end=" ")
print()