A quick and dirty C solution to problem 7