Adding solution for problem 52 in c.