Powers of Two
Use a while loop to print all powers of 2 from 1 up to 256, one per line.
Expected output:
text
1 2 4 8 16 32 64 128 256
Hints:
- Start with
let mut n = 1; - Multiply
nby 2 each time - Loop while
n <= 256 - Print
nbefore multiplying!
rust
fn main() {
}