5.12 · exercise
Count by sevens
Print every multiple of seven from 7 up to and including a limit, one per line. The starter reads the limit and holds the first multiple and the limit in callee-saved registers, which any function you call must hand back unchanged.
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 change the caller-saved registers; that is why the loop state lives in x19 and x20.
What is checked
- ten lines,
7through70, for the limit in the stdin box - the program exits cleanly
- a comparison drives the loop
- the same holds for other limits you do not see; a limit below 7 prints nothing
specification
stdin70
stdoutprints the right output
exitexits with the right code
sourceuses
cmphiddenright output and exit code on 4 more inputs you do not see
We run your program on the input above and on the hidden ones, and compare what it does. Nothing is matched against a stored solution.