Code for problem 11.