Solution for Problem 17