Added ex 5 solution