Row and column algorithm Looking for help in revising my algorithm. I need to find one that will give me the row and column of a cell on a grid. 
The grid is $t \times t$. 
For example, this is a grid for $t=5$. Now given $n$, find the row and column.
$$\begin{array}{|c|c|c|c|c|}
1& 2& 3& 4& 5\\
6& 7& 8& 9& 10\\
11& 12& 13& 14& 15\\
16& 17& 18& 19& 20\\
21& 22& 23& 24& 25
\end{array}$$
My attempt:
row: $n / t + 1$
column: $n \bmod t$  
Second attempt:
$\operatorname{row}(x, t) = ((x-x \bmod t)/t)+1$ 
$\operatorname{column}(x,t) = (x-1) \bmod t+1$   
Doesn't work for $n = t^2$ 

The row is :$$r = \lfloor \frac{n-1}{t} \rfloor + 1$$
The column is:$$c = n - t(r-1)$$
