added the solution for prob 8