solved prac2 problem1.8