Adding solution for problem 5
Adding solution for problem 6 in c.