Hint for X star pattern

Facing an issue in building up logic for this assignment Q.8
Need a little hint to proceed further with the same.

We need to print n rows and n columns. So we run two nested loops. The outer loop prints all rows one by one (runs for i = 1 to n). The inner loop (runs for j = 1 to n) runs all columns of current row. Now a row can contain spaces and stars. How do we decide where to put space and where stars.

For i = 1 : First and last column should contain star
For i = 2 : Second and second last column should contain star
In general, i-th and (n + 1 – i)-th columns should contain star