This is my code for ex 2