Chapter1 - Exercise 3

question 9 writeup and c implementation