change do-while to increment  by *=