5.13 · exercise

the overeager counter

warning

This program is broken. Find the bug and fix it so the checks pass.

This countdown should print 5 through 1 and stop. Run it and look closely at the output: it goes one line too far.

The loop's exit test is the culprit. Fix the condition so the countdown ends where it should, and leave everything else alone.

what is checked

  • exactly five lines, 5 down to 1
  • the program exits cleanly
  • the countdown still comes from the loop

Specification

args
stdoutprints the expected output
exitexits with the expected code
sourceuses sub

Checked by running your program against expected behavior, never by matching a stored solution.

loading editor...
Open in playground