solving problem 9
 Solving Problem 9