solve exercise 24.18