solution for problem 21