Start an integer value at 1024. Loop while it is greater than 0. Print the value (with a newline) and divide it by two each time through the loop.
Alternatively, it can be done with for:
Indeed, in C++,
is equivalent to
Content is available under GNU Free Documentation License 1.2.