Adding solution for problem 17 in c.