← Unit 2 · all exercises
Saved in this browser only

Count down

Print the numbers from the starting value down to 1, each on its own line. If the start is below 1, print nothing.

void countdown(int from)

Solution.java
Loading editor…
Results

Examples

  • countdown(3) → 3 2 1
  • countdown(1) → 1

There are also 3 hidden tests you can't see. Solve the problem, not the examples.