Adding solution for problem 23 in c.