Solved ex1.1 and ex1.2