5.20 · exercise
Fizzbuzz, by hand
The classic interview question, on a machine with no remainder instruction: print the numbers 1 through a limit, except say fizz for multiples of 3, buzz for multiples of 5, and fizzbuzz for multiples of both. The starter reads the limit.
AArch64 has division but no remainder instruction. The usual way around that is udiv then msub: divide, multiply the quotient back, subtract, and what is left is the remainder.
What is checked
- all fifteen lines in order for the
15in the stdin box - the program exits cleanly
- the remainders come from
msub, not from a lookup - the same holds for other limits you do not see; a limit of 0 prints nothing
specification
stdin15
stdoutprints the right output
exitexits with the right code
sourceuses
msubsourceuses
udivhiddenright 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.