Code for problem 30A.