Added ex 7 solution