Adding solution for problem 54 in c.