Code for problem 370C.