Adding solution for problem 15 in c.