Exercising programming with some simple math