LearnPy Hub
← Loops problems
Medium

Powers of Two up to n

Read n and print every power of two (1, 2, 4, …) that is ≤ n, on one line, using a while loop.

Input

One integer n ≥ 1.

Output

One line.

Sample 1

Input
20
Output
1 2 4 8 16

Sample 2

Input
1
Output
1
solution.py
Output appears here
Powers of Two up to n · Python practice problem · LearnPy Hub