5.15 · exercise
echo the sum
Read two integers from input with scanf, add them, and print the total.
scanf does not want values, it wants addresses to write into. The starter reserves two stack locals in the frame and names their offsets; build each pointer with add xN, fp, offset, hand both to scanf, then load the values back out of the frame to do the arithmetic.
what is checked
- the sum of the two input numbers is printed on its own line
- the program exits cleanly
- the answer is computed, not written in
Specification
args
stdin12 30
stdoutprints the expected output
exitexits with the expected code
sourceuses
addsourcecomputes the result (does not hardcode it)
Checked by running your program against expected behavior, never by matching a stored solution.
loading editor...