added solution for exercise 19(p)