simple programming exercise