Practice problems from Learn to Program, chapter 6.