Adding solution for problem 59 in c.