Code for problem 65B.