Code for problem 25B.