We learned to do that in my second CS class at university. It is a common way to represent a matrix. instead of keeping track of just `i`, you will also have a row index and use the modulus operator on the iterator tracking (i) to get the column index.