Program #4 Solution



In this assignment, you will create a simple integer division calculator that will compute the floating point result of the division of two integers n and d (numerator and denominator).

When executed, your program will immediately wait for the user to enter the value of n and d, which will be integer values (positive or negative). Once entered, you will call the _divide procedure to compute the decimal result of n / d. Once the decimal result is calculated, the program should print the following output string and immediately loop back to main to accept another pair of operands:

n / d = x

Your main function take inputs in the following format, then immediately perform the operations specified above.



Points will be assigned as follows:

  1. Main function correctly retrieves 2 input parameters and loops back to main (20 points)

  1. Result string correctly prints input parameters in proper format (20points)

  2. Result string correctly prints division result in proper format (30 points)

  3. Division result is correct in all cases (30 points)

Hint: When printing a float value, printf requires double precision numbers (64 bits). You will not be able to print all 3 values (n, m, and the result) with a single printf command.

Submit your solution as a single “.s” file to Blackboard. Name the file “abc1234_p3.s”, where abc1234 is your NetID.