Code for problem 35A.