solution for problem 15, 16, 17