A simple programming exercise