working on p21 c solution