Adding solution for problem 13 in c.