problem 20 solution by two methods