HW #4

Similar to my comments on #2, I think you could reduce this one considerably so that it runs in one loop. It will use a number of the same conventions.