Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

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 n by 2 each time
  • Loop while n <= 256
  • Print n before multiplying!
rust
fn main() {
}