add solutions for last prog question