ex5.3 basic approach