problem 21, uses prob 12 code