5.57 · exercise
Echo the sum
Read two integers from input with scanf, add them, and print the total.
scanf takes the address of each variable it fills in. 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
- the same holds for other pairs you do not see, zeros and negative numbers among them
specification
stdin12 30
stdoutprints the right output
exitexits with the right code
sourceuses
addsourcedoes not hardcode the answer
hiddenright 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.