Solution for problem 6
Solution for problems 6 and 7