Solve exercise 1-18 on the page 31