Watch an X print in stars: both diagonals of the square, j equals i or j equals n minus 1 minus i, cell by cell.
About this algorithm
The X cross prints both diagonals of an n by n square. With an odd n they cross at one star in the middle, and the result reads as a letter X.
Do it after the hollow square. Both are position tests rather than counts; here the positions are the two diagonals instead of the four edges, and one OR joins them.
n rows and n columns.
From the top left to the bottom right, the column equals the row: j == i.
From the top right to the bottom left, the column counts down as the row counts up: j == n - 1 - i. A cell is a star when either is true.
A 5 by 5 grid. Rows 0, 1, 3 and 4 have two stars, and row 2 has one, where the diagonals cross. That is 9 stars, 2n - 1, and 16 spaces in 25 cells.
With an even n no cell is on both diagonals, so there are 2n stars and the two middle rows each print two stars side by side. Try n = 4 and n = 6 on the slider to see the difference.
OR the hollow square's edge test onto this one and you get a square with an X inside, a common follow-up exercise.
Time: each of the n² cells is tested once. Space: the test needs only i, j and n.