solve exercise 9.24