5.11 · exercise

count by sevens

Print every multiple of seven from 7 up to and including 70, one per line.

The starter holds the first multiple and the limit in callee-saved registers. Write the loop: print, step by seven, and keep going while the counter has not passed the limit. Since printf is a function call, it is free to clobber the caller-saved registers; that is exactly why the loop state lives in x19 and x20.

what is checked

  • ten lines, 7 through 70
  • the program exits cleanly
  • a comparison drives the loop

Specification

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

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

loading editor...
Open in playground