5.14 · exercise
fizzbuzz, by hand
The classic interview question, without the safety net of a remainder operator: print the numbers 1 through 15, except say fizz for multiples of 3, buzz for multiples of 5, and fizzbuzz for multiples of both.
AArch64 has division but no remainder instruction. The course idiom is udiv then msub: divide, multiply the quotient back, subtract, and what is left is the remainder.
what is checked
- all fifteen lines, exactly as fizzbuzz demands
- the program exits cleanly
- the remainders come from
msub, not from a lookup
Specification
args
stdoutprints the expected output
exitexits with the expected code
sourceuses
msubsourceuses
udivChecked by running your program against expected behavior, never by matching a stored solution.
loading editor...