Creating a Crossed Square
VBA Excel, 168 bytes
Instruction:
I find Excel with the help of VBA is an effective and a sufficient tool for this challenge. Set the worksheet of Excel like following
Yes, we use the small, classic square-shaped pixels like the old times by using the cells in a worksheet as the pixels. Ha-ha...
Here I use cell A1 as the input and I change its font color to red. Why red? Because red is three-letter-color so it fits for golfing. Write and run the following code in the Immediate Window:
N=[A1]:Range("A1",Cells(N,N)).Interior.Color=vbRed:Range("B2",Cells(N-1,N-1)).Clear:For i=1To N:Cells(i,i).Interior.Color=vbRed:Cells(i,N+1-i).Interior.Color=vbRed:Next
Ungolfed the code:
Sub A()
N = [A1]
Range("A1", Cells(N, N)).Interior.Color = vbRed
Range("B2", Cells(N - 1, N - 1)).Clear
For i = 1 To N
Cells(i, i).Interior.Color = vbRed
Cells(i, N + 1 - i).Interior.Color = vbRed
Next
End Sub
Step-by-step Explanation:
N = [A1]: Range("A1", Cells(N, N)).Interior.Color = vbRed
Range("B2", Cells(N - 1, N - 1)).Clear
Looping through the diagonal of range cells: Cells(i, i).Interior.Color = vbRed
Final step and output: Cells(i, N + 1 - i).Interior.Color = vbRed
MATL, 20 19 17 bytes
2-:XdtP!+~TTYa1YG
You can try it experimentally in MATL online. You may need to refresh the page if it doesn't work.
Sample run:
ASCII version: 19 bytes
2-:XdtP!+~TTYa~42*c
Try it online!
JavaScript (ES6), 96 bytes
f=
n=>[...Array(n--)].map((_,i,a)=>a.map((_,j)=>i&&j&&n-i&&n-j&&i-j&&n-i-j?' ':'*').join``).join`
`
;
<input type=number min=1 step=2 oninput= o.textContent=f(this.value)><pre id=o>