Once the where i%n does equal zero, it won't ever add 1 to i again. Also, when is the program exactly finished?