4.3.9 Construct algorithms using loops and branching