Added my code for problem 2.22