CSCI 1120 (Low-Level Computing), Fall 2017:
Homework 3 Solution (Programming Problems)

Note about error checking: Starting with this assignment, I do want you to do at least minimal checking that input from standard input is sensible. As mentioned in class, doing a really great job of parsing and validating input is not especially easy, but for our purposes it's enough to check that scanf was able to get value(s) of the requested type(s) and that the values meet whatever other criteria the problem states (e.g., not negative for the second problem).

  1. (5 points) Refer to assignment for description of problem.

    Solution: Here are two solutions, first the one beginners are most likely to write and then one that adapts ideas from more general sorts to use for this particular limited case.

  2. (5 points)

    Refer to assignment for description of problem.

    Solution: Here is one solution:



Berna Massingill
2017-09-30