Code for problem 34B.