All you have to do is to use modulo operator. If you don't know what modulo operator is, see wiki http://en.wikipedia.org/wiki/Modulo_operation or simple example here:...