Solutions for program 5