[Question]
  [
## Creating a Crossed Square
You are to take input of an integer of one or more and output a square made of any printable character of your choice with a diagonal cross through the centre.
The general idea is for the output to be a hollow square that has a diagonal cross through it.:
```
Input: 7
Output:
*******
*#   #*
* # # *
*  #  *
* # # *
*#   #*
*******
```
In the above example the '\*'s represent the outer box and the '#'s represent the diagonal cross.
Note that the above example uses two different characters so that it is easier to see what the output looks like, your program should use one character only.
**Input**
An integer of 1 or more, it is guaranteed to be odd.
**Output**
A square that is made up of a character of your choice with a cross through the middle.
* The cross must be diagonal
* The square may be output via the function or written to output
* Trailing newlines are okay
* Can output as a graphic, diagram or image if you wish too
**Examples**
```
Input: 1
Output:
*
Input: 3
Output:
***
***
***
Input: 5
Output:
*****
** **
* * *
** **
*****
Input: 7
Output:
*******
**   **
* * * *
*  *  *
* * * *
**   **
*******
```
**Specs**
* Functions or full programs are allowed
* You can get input by your preferred means
* Standard loopholes are disallowed
* Programs must work without any additional statements i.e. `using`s in `C#`, they must be included in the entry
* You can output from a function or print the result
This is code golf so the shortest solution wins.
  
[Answer]
# 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
[![enter image description here](https://i.stack.imgur.com/agEBY.png)](https://i.stack.imgur.com/agEBY.png)
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
```
[![enter image description here](https://i.stack.imgur.com/Lso5N.png)](https://i.stack.imgur.com/Lso5N.png)
```
Range("B2", Cells(N - 1, N - 1)).Clear
```
[![enter image description here](https://i.stack.imgur.com/PKpZi.png)](https://i.stack.imgur.com/PKpZi.png)
Looping through the diagonal of range cells: `Cells(i, i).Interior.Color = vbRed`
[![enter image description here](https://i.stack.imgur.com/MXTAZ.png)](https://i.stack.imgur.com/MXTAZ.png)
Final step and output: `Cells(i, N + 1 - i).Interior.Color = vbRed`
[![enter image description here](https://i.stack.imgur.com/IoHQ2.png)](https://i.stack.imgur.com/IoHQ2.png)
[Answer]
# [MATL](http://github.com/lmendo/MATL), ~~20~~ ~~19~~ 17 bytes
```
2-:XdtP!+~TTYa1YG
```
You can try it experimentally in [MATL online](https://matl.io/?code=2-%3AXdtP%21%2B%7ETTYa1YG&inputs=11&version=19.0.0). You may need to refresh the page if it doesn't work.
Sample run:
[![enter image description here](https://i.stack.imgur.com/ltyje.png)](https://i.stack.imgur.com/ltyje.png)
## ASCII version: 19 bytes
```
2-:XdtP!+~TTYa~42*c
```
[Try it online!](http://matl.tryitonline.net/#code=Mi06WGR0UCErflRUWWF-NDIqYw&input=MTE)
[Answer]
## 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>
```
[Answer]
## Python 2, 65 bytes
```
i=n=2**input()/2
while i:print bin((n>i>1or~-n)|n|i|n/i)[2:];i/=2
```
Uses [Jonathan Allan's idea](https://codegolf.stackexchange.com/a/91080/20260) of outputting binary numbers like:
```
11111
11011
10101
11011
11111
```
The rows are created with bit arithmetic and displayed in binary. Each part it or'ed into the rest. The part are are produced by powers of 2 `n` (fixed) and `i` (falling) via
1. Left side `1`
2. Right side `n`
3. Diagonals `i` and `n/i`
4. Top and bottom by `n-1` when `i==1` or `i==n`.
Actually, (1) and (4) are combined by producing `1` when `1<i<n` and `n-1` otherwise.
[Answer]
# Python, ~~114 110 96~~ 90 bytes
Totally changed:
```
lambda n:[bin(sum(2**p for p in[range(n),{0,n-1,r,n-1-r}][0<r<n-1]))[2:]for r in range(n)]
```
Returns a list of strings, characters using `1` and `0`.  
-6 bytes thanks to TheBikingViking
Test it at [**ideone**](http://ideone.com/7vCZzO)
---
Previous Python 2 @110
```
def f(n):g=range(n);n-=1;print'\n'.join(''.join((c in(r,n-r,0,n)or r in(0,n))and'#'or' 'for c in g)for r in g)
```
Test it on [**ideone**](http://ideone.com/3CO1cW)
[Answer]
# Java 7, ~~131~~ ~~130~~ ~~128~~ ~~125~~ ~~124~~ 122 bytes
```
String c(int n){String r="";for(int i=n,j;n-->0;r+="\n")for(j=0;j<n;r+=i*j<1|n-i<2|n-j<2|i==j|i==n-++j?"*":" ");return r;}
```
3 bytes saved thanks to *@LeakyNun*;  
1 byte saved thanks to [*@OliverGrégoire* in my answer for the *Draw a hollow square of # with given width*](https://codegolf.stackexchange.com/a/98871/52210) challenge;  
2 bytes saved thanks to *@cliffroot*.
**Ungolfed & test code:**
[Try it here.](https://ideone.com/VCUnRP)
```
class M{
  static String c(int n){
    String r = "";
    for(int i = n, j; n-- > 0; r += "\n"){
      for(j = 0; j < n;
            r += i < 1      // Responsible for the first horizontal line
               | j < 1      // Responsible for the first vertical line
               | n-i < 2    // Responsible for the last horizontal line
               | n-j < 2    // Responsible for the last vertical line
               | i == j     // Responsible for the top-left to bottom-right diagonal line
               | i == n-++j // Responsible for the top-right to bottom-left diagonal line (and increasing j)
             ? "*"
             : " ");
    }
    return r;
  }
  public static void main(String[] a){
    System.out.println(c(1));
    System.out.println(c(3));
    System.out.println(c(5));
    System.out.println(c(7));
  }
}
```
**Output:**
```
*
***
***
***
*****
** **
* * *
** **
*****
*******
**   **
* * * *
*  *  *
* * * *
**   **
*******
```
[Answer]
# Matlab, ~~68 66 64~~ 58 bytes
Since graphical output is allowed too:
```
k=input('');[x,y]=ndgrid(abs(-k:k));spy(~(max(x,y)<k&x-y))
```
Which outputs e.g.
[![enter image description here](https://i.stack.imgur.com/e9KcY.png)](https://i.stack.imgur.com/e9KcY.png)
The ascii only versions would be:
This is using the indexing `0,1,2,3,...`
```
k=input('');[x,y]=ndgrid(abs(-k:k));[(max(x,y)==k|~(x-y))*42,'']
```
Alternatively with the indexing `1,3,7,...`:
```
n=input('');k=1:n;m=eye(n);m([k,end-k+1])=1;[(m|flip(m'))*42,'']
```
[Answer]
# C#, ~~112~~ 101 bytes
Thanks to TheLethalCoder for reminding me that these anonymous lambda statement-nor-expression things are allowed in C#.
```
n=>{var r="";for(int y=n--,x;y-->0;r+="*\n")for(x=0;x<n;r+=y%n*x<1|y==x|y==n-x++?"*":" ");return r;};
```
Who said C# isn't a fun golfing language?
[Answer]
# Logo, 155 bytes
## Graphical solution, implemented as a function
I retooled my answer for [Alphabet Triangle](https://codegolf.stackexchange.com/a/87610/56253) and changed the angles around a bit. As before, `r` draws a line of characters. This time, the `b` function draws a box by drawing one straight edge and one diagonal, rotating, and repeating four times. This causes the diagonals to be drawn twice (on top of each other), but it was less code than handling it separately. This answer also properly handles even numbers. I had to add special handling for an input of `1` to prevent it from going forward.
I implemented it as a function, `b` which takes the size as an argument:
```
pu
to r:n:b:l repeat:n[rt:b label "A lt:b if repcount>1[fd:l]] end
to b:s
repeat 4[rt 90
r:s 90-heading 20 rt 135
r:s 90-heading 20*sqrt 2 rt 45]
end
```
Try it out on [Calormen.com's Logo interpreter](http://www.calormen.com/jslogo/).
To call it, append a line and call `b` in the following format:
```
b 7
```
[![Sample of size 7](https://i.stack.imgur.com/1zIUG.png)](https://i.stack.imgur.com/1zIUG.png)
... or try the sampler platter, which draws four samples in sizes 5, 7, 9, and 11, rotating 90 degrees in between:
```
repeat 4[
  b repcount*2+3
  rt 90
]
```
[![Sample of multiple sizes](https://i.stack.imgur.com/CarSZ.png)](https://i.stack.imgur.com/CarSZ.png)
[Answer]
# R, 102 bytes
```
    n=scan();for(i in 1:n){for(j in 1:n){z=" ";if(i%in%c(1,n,n-j+1)|j%in%c(1,i,n))z="*";cat(z)};cat("\n")}
```
Note that it is more efficient to express the condition using %in% than i==1|j==1|...
[Answer]
# Haskell, ~~102~~ ~~100~~ ~~96~~ ~~91~~ 87 bytes
```
c s=unlines.f$f.(#)where f=(<$>[1..s]);x#y|elem y[1,s,x]||elem x[1,s,s-y+1]='*'|1>0=' '
```
* Saved 2 bytes, thanks to [flawr](https://codegolf.stackexchange.com/users/24877/flawr "flawr").
* Saved 4 more bytes by using list comprehensions.
* 5 bytes saved combining [flawr](https://codegolf.stackexchange.com/users/24877/flawr "flawr")'s improvement with `any`
* 4 bytes saved by replacing `any` with `elem`
**Ungolfed version:**
```
cross :: Int -> String
cross s = unlines $ map line [1..s]
    where line y = map (pos y) [1..s]
          pos y x | x == y = '*'
                  | x == s - y + 1 = '*'
                  | y `elem` [1, s] = '*'
                  | x `elem` [1, s] = '*'
                  | otherwise = ' '
```
I'm sure this can still be improved, but this is what I've come up with for now.
**Old version:**
```
c s=unlines.f$f.(#)where f=(<$>[1..s]);x#y|any(==y)[1,s,x]||any(==x)[1,s,s-y+1]='*'|1>0=' '
```
[Answer]
# Java, 130 bytes
```
s->{for(int i=0;i<s;i++)for(int j=0;j<s;j++)System.out.print((s-1-i==j||i==j||i==0||j==0||i==s-1||j==s-1)?j==s-1?"*\n":"*":" ");};
```
# Test Program
```
Consumer<Integer> consumer = s -> {
        for (int i = 0; i < s; i++) {
            for (int j = 0; j < s; j++) {
                System.out.print((s - 1 - i == j || i == j || i == 0 || j == 0 || i == s - 1 || j == s - 1) ? j == s - 1 ? "*\n" : "*" : " ");
            }
        }
    };
    consumer.accept(20);
```
[Answer]
# C, ~~140~~ ~~121~~ 114 bytes
**19 bytes thanks to Quentin.**
7 bytes saved by switching from a double-nested loop to one loop.
```
main(a){scanf("%d",&a);for(int i=0;i<a*a;i++,i%a||puts(""))putchar(i/a&&i/a^a-1&&i%a&&-~i%a&&i%-~a&&i%~-a?32:42);}
```
Golfing suggestions welcome.
[Answer]
## PowerShell (133)
```
filter s($x){1..$x|%{$o="";$r=$_;1..$x|%{if($_-eq1-or$r-eq1-or$_-eq$x-or$r-eq$x-or$r-eq$_-or$r-1-eq$x-$_){$o+="*"}else{$o+="_"}};$o}}
```
Clunky, but it works well enough.
```
s(11)
***********
**_______**
*_*_____*_*
*__*___*__*
*___*_*___*
*____*____*
*___*_*___*
*__*___*__*
*_*_____*_*
**_______**
***********
```
Golfing suggestions definitely welcome, it's been too long since I've PowerShell'd.
[Answer]
# [S.I.L.O.S](http://github.com/rjhunjhunwala/S.I.L.O.S), 212 bytes
```
readIO 
a = i
lbla
a - 1
t = a
t + 1
t % i
t * a
b = i
lblb
b - 1
u = b
u + 1
u % i
u * b
u * t
v = a
v - b
u * v
v = a
v + b
v + 1
v % i
u * v
u |
if u c
print #
GOTO d
lblc
print .
lbld
if b b
printLine 
if a a
```
[Try it online!](http://silos.tryitonline.net/#code=cmVhZElPIAphID0gaQpsYmxhCmEgLSAxCnQgPSBhCnQgKyAxCnQgJSBpCnQgKiBhCmIgPSBpCmxibGIKYiAtIDEKdSA9IGIKdSArIDEKdSAlIGkKdSAqIGIKdSAqIHQKdiA9IGEKdiAtIGIKdSAqIHYKdiA9IGEKdiArIGIKdiArIDEKdiAlIGkKdSAqIHYKdSB8CmlmIHUgYwpwcmludCAjCkdPVE8gZApsYmxjCnByaW50IC4KbGJsZAppZiBiIGIKcHJpbnRMaW5lIAppZiBhIGE&input=&args=MTU)
[Answer]
## GNU sed, ~~117~~ 114 + 1(r flag) = 115 bytes
```
p;/^0$/Q;/^000$/{p;q}
h;s/./ /3g;s/  $/00/
:f;/ 00 /!{G;h;s/\n.*//p;t;:}
s/^(0 *)0  ?( *)0/\1 0\20 /
tf;s/00/0/p;g
```
Since sed has no native support for numbers, the input is given in unary based on this [consensus](http://meta.codegolf.stackexchange.com/questions/5343/can-numeric-input-output-be-in-unary?answertab=votes#tab-top "consensus"). The second half of the square is the first half that was stored in reverse order in hold space.
**Run:**
```
sed -rf crossed_square.sed <<< "00000"
```
**Output:**
```
00000
00 00
0 0 0
00 00
00000
```
[Answer]
# Python, 89 bytes
This was a throwback! I used python's turtle module.
```
from turtle import*
n=input()
for i in[(n,n),(n,0),(0,n),(0,0),(n,0),(0,n),(n,n)]:goto(i)
```
Here's the result when n=200:
[![enter image description here](https://i.stack.imgur.com/5deDQ.png)](https://i.stack.imgur.com/5deDQ.png)
[Answer]
# Scala, 141 137 bytes
```
val s=args(0).toInt-1;val t=0 to s;print(t.map{x=>t.map{y=>if(x==0||x==s||y==0||y==s||x==y||x==s-y)"*" else " "}.mkString+"\n"}.mkString)
```
Run:
`$ scala cross.scala 10`
Technically I could remove the print stuff and go to something like
```
def c(n:Int)={val (s,t)=(n-1,0 to n-1);t.map{x=>t.map{y=>if(x==0||x==s||y==0||y==s||x==y||x==s-y)"*" else " "}.mkString+"\n"}.mkString}
```
This would make it 135 or 121 bytes depending on whether you count the function syntax stuff.
Readable version:
```
def cross(n: Int) = {
   // Declares both s and t as variables with tuple expansion
   // s is the zero-based size and t is a range from 0 to s
   val (s,t) = (n-1, 0 to n-1)
   // Maps all rows by mapping the columns to a star or a space
   t.map { x =>
      t.map { y =>
        if (x == 0 || x == s || y == 0 || y == s || x == y || x == s-y) "*" 
        else " "
      }.mkString+"\n" // Concatenate the stars and spaces and add a newline
   }.mkString         // Concatenate the created strings
 }
```
[Answer]
# Pyth, ~~27~~ 25 bytes
```
jmsm?|qFKaLJ/Q2,dk}JKN\ Q
```
[Try it online!](http://pyth.herokuapp.com/?code=jmsm%3F%7CqFKaLJ%2FQ2%2Cdk%7DJKN%5C+Q&input=11&debug=0)
Probably golfable.
[Answer]
## Python 2, 83 bytes
```
i=n=input()
while i:l=['* '[1<i<n]]*n;i-=1;l[0]=l[~0]=l[i]=l[~i]='*';print`l`[2::5]
```
Modifies a list of the row's characters to put a `*` into the first, last, i'th, and i'th-to-last place. The first and last row start as all `*`, and the rest as all spaces. Works for evens too. A `lambda` expression is probably shorter than modification, but I like this method.
[Answer]
## Pyke, ~~28~~ ~~24~~ 23 bytes
```
]Ua]jshqjXq|0[j{|)Qt[)P
```
[Try it here!](http://pyke.catbus.co.uk/?code=%5DUa%5DjshqjXq%7C0%5Bj%7B%7C%29Qt%5B%29P&input=7&warnings=0)
[Answer]
# Mathematica, 81 bytes
```
""<>#&/@Table[If[i^2==j^2||i^2==#^2||j^2==#^2,"*"," "],{i,-#,#},{j,-#,#}]&[(#-1)/2]&
```
Creates a coordinate system with the origin in the center, and computes where the `*`s should go. Outputs an array of strings, one per row.
[Answer]
# Javascript (289 270 bytes)
```
function s(a){b=[];for(i=0;i<a;i++)if(b.push([]),0==i||i==a-1)for(j=0;j<a;j++)b[i].push("*");else for(j=0;j<a;j++)0==j||j==a-1?b[i].push("*"):j==i||a-1-j==i?b[i].push("*"):b[i].push(" ");c="";for(i=0;i<b.length;i++){for(j=0;j<b[i].length;j++)c+=b[i][j];c+="\n"}return c}
```
Ungolfed:
```
function square(size){
str=[];
for(i=0;i<size;i++){
    str.push([]);
    if(i==0||i==size-1){
        for(j=0;j<size;j++){
            str[i].push("*");
        }
    }else{
        for(j=0;j<size;j++){
            if(j==0||j==size-1){
                str[i].push("*");
            }else if(j==i||size-1-j==i){
                str[i].push("*");
            }else{
                str[i].push(" ");
            }
        }
    }
}
out="";
for(i=0;i<str.length;i++){
    for(j=0;j<str[i].length;j++){
        out+=str[i][j];
    }
    out+="\n";
}
return out;
}
```
EDIT:
Saved 19 bytes thanks to Philipp Flenker.
[Answer]
# Charcoal, 8 bytes (noncompeting; language postdates challenge)
```
ＧＨ+↘↑↙Ｎ*
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z8gP6cyPT/PIz8nJ79cw0pbwcolvzwvKDM9o0TBKrQAwvVJTSvRUfDMKygt8SvNTUot0tDUUVDSUtK0/v/f/L9u2X/d4hwA "Charcoal – Try It Online") Link is to verbose version of code. Explanation: When used as a parameter to the `PolygonHollow` command, `+` draws a box, and the arrows then create the diagonals. There are some other shortcut characters but they would need to be redefined to be useful e.g. `Y` is equivalent to `↖↗↓` but if it was eqivalent to `↗↓↖` then `Y+` would suffice.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 7 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
0•V¾²•Λ
```
[Try it online](https://tio.run/##yy9OTMpM/f/f4FHDorBD@w5tAtLnZv//bw4A) or [verify all test cases](https://tio.run/##S0oszvifnFiiYKeQnJ@SqpdfnJiUmapgY6Pg6u/GdWib/X@DRw2Lwg7tO7QJSJ@b/R8kzFWekZmTqlCUmpiikJnHlZLPpaCgn19Qog/RDaXQDLRRUAGrzUv9b8hlzGXKZc5laMwFAA).
**Explanation:**
```
0        # Push 0
 •V¾²•   # Push compressed integer 2064147
      Λ  # Use the Canvas builtin with the given three options:
         #  Length of the lines: the (implicit) input-integer
         #  Character/string to display: the "0"
         #  Directions: [2,0,6,4,1,4,7]
         # (after which the result is output implicitly immediately)
```
[See this 05AB1E tip of mine (section *How to compress large integers?*)](https://codegolf.stackexchange.com/a/166851/52210) to understand why `•V¾²•` is `2064147`.
The Canvas Builtin uses three arguments to draw a shape:
* Length of the lines we want to draw: which is the input in this case
* Character/string to draw: the `0` (could be any other digit as well)
* The direction to draw in: the `[2,0,6,4,1,4,7]`, where each digit represents a certain direction:
```
7   0   1
  ↖ ↑ ↗
6 ← X → 2
  ↙ ↓ ↘
5   4   3
```
So the `[2,0,6,4,1,4,7]` in this case translates to the directions \$[→,↑,←,↓,↗,↓,↖]\$.
Here a step-by-step explanation of how it draws for example input `7` with these steps:
Step 1: Draw 7 characters (`"0000000"`) in direction `2→`:
```
0000000
```
Step 2: Draw 7-1 characters (`"000000"`) in direction `0↑`:
```
      0
      0
      0
      0
      0
      0
0000000
```
Step 3: Draw 7-1 characters (`"000000"`) in direction `6←`:
```
0000000
      0
      0
      0
      0
      0
0000000
```
Step 4: Draw 7-1 characters (`"000000"`) in direction `4↓`:
```
0000000
0     0
0     0
0     0
0     0
0     0
0000000
```
Step 5: Draw 7-1 characters (`"000000"`) in direction `1↗`:
```
0000000
0    00
0   0 0
0  0  0
0 0   0
00    0
0000000
```
Step 6: Draw 7-1 characters (`"000000"`) in direction `4↓`:
```
0000000
0    00
0   0 0
0  0  0
0 0   0
00    0
0000000
```
Step 7: Draw 7-1 characters (`"000000"`) in direction `7↖`:
```
0000000
00   00
0 0 0 0
0  0  0
0 0 0 0
00   00
0000000
```
After which the result is output implicitly immediately afterwards.
[See this 05AB1E tip of mine for an in-depth explanation of the Canvas builtin.](https://codegolf.stackexchange.com/a/175520/52210)
[Answer]
# Perl, 83 +1 = 84 bytes
Run with the `-n` flag.
```
$\="*
*";print$c="*"x($_+1);for$b(1..$_){@a=($")x$_;@a[$b-1,-$b]=(a,a);print@a}say$c
```
The literal newline saves 1 byte over `\n` or `$/`.
Readable:
```
$\="*\n*";
print$c="*"x($_+1);
for$b(1..$_){
    @a=($")x$_;
    @a[$b-1,-$b]=(a,a);
    print@a
}
say$c
```
The code prints the top line and saves it in `$c`, then prints a bunch of spaces with the appropriate slots replaced with `a`s, then prints the top line again.
The assignment to the `$\` variable tells the interpreter to print the contents (an asterisk, a newline, and another asterisk) after every `print`, but this does NOT occur after a `say`.
[Answer]
# SmileBASIC, 46 bytes
```
INPUT I
GBOX I,I,1,1GLINE 1,I,I,1GLINE 1,1,I,I
```
(No, SB does NOT use 1-indexed graphics...)
[Answer]
**SHELL** ( **135 Bytes**):
```
 C(){ j=$(($1-1));for i in $(seq 0 $j);do dc<<<2o10i`echo $((1|2**$i|2**($j-$i)|2**$j|(($i==0||$i==$j))*(2**$j-1)))`p;done|tr 01 ' X';}
```
tests:
```
 C 1
 X
 C 3
 XXX
 XXX
 XXX
 C 5
 XXXXX
 XX XX
 X X X
 XX XX
 XXXXX
 C 7
 XXXXXXX
 XX   XX
 X X X X
 X  X  X
 X X X X
 XX   XX
 XXXXXXX
 C 9
 XXXXXXXXX
 XX     XX
 X X   X X
 X  X X  X
 X   X   X
 X  X X  X
 X X   X X
 XX     XX
 XXXXXXXXX
```
[Answer]
# [Kotlin](https://kotlinlang.org), ~~123~~ 116 bytes
change if with \n to println
```
{s:Int->val n=s-1
for(r in 0..n){for(c in 0..n)print(if(n-r==c||r==c||r<1||c<1||r==n||c==n)"#"
else " ")
println()}}
```
[Try it online!](https://tio.run/##hVZNb9s4EL3rVwycQ20jtmsUaXeNukCRbYFetguklwV6oaWxxTVFqiQV25v0t2dnSEqW4garNhIpzve8efLeeCX102IKtxaFxwK2xkJuCoSdUVvIS6EU6h1mpfe1Wy0WfMZHc@dFvscjSdDxPDfV4keDzkuj3eL35eu3vy1yNin1biZmuTXOYTFzPxphMbtNJyDIbziBu3iS/W0aoAV4A17sEaSuGw9mC0LT2uMOLe@MRqBIK0OiQhdgGs9yAqIHqASlELROUFtSFBuFnI4VuY8mTqahVEsjc4SD9CUpF1LsjBYKQrzgS2uaXUlPUkXtLc6z7BttdqjRkpgsUIB0oWgslKKg2DcUFpRGKXNoQ/Kl8FAK97If6eerLPvCGa/gXfY1WFtl03hl0ysAuKInXNE/ftIDevv2PMmTpRCV2Jh7BDyKqlYY3ryavnJgsbboKK02dCrLxhxDOYPQ1YXQMG4qxp/Gp8QuHTUOKbWDIa3tFi3b6OrvwJmoJz0XEIWT5J4K55C60RpM9VTG7B0oucfr2LXamp0VFbjSNKpgTwEQvfZqdZqnUmbZxwF0li1wrpPzHbVH0DmhMHbOFAUpx/KT9qCBJB@w1dQBXv8LqUskVbIoFCOJugWMpihSNc6z87bG3XGH6FOILZbkXopgbNvonGeOczpY6T1qTiJKRRNWSMWzpvFAT@oJWzN7cQrHtzRX7fAwNKmudSnz6xAH15gMy0rsaBJDfpSXozyMybJPsdGug@zyDNnu3Zs@jLu/9vRmCHK6A99hCt162pf/xVDQFHQ6cSimcSg6K9DZYUt3NeYuFv9zKp7jJLeNUi2wYo0ETy8WQZRpKadS7dAnStqcWiwiodsSeCoU2gXpO09DJGzByK2JBVLRC@n6Nv9qnYXWH4zdB9AYbgXRligKydHRuBHXeqxoghzIOc4J8NRQWmu4vbpmHJw6@Eidq6agaGQcfqat0yCF1O2tNRX1uw@gQJRBi2a@UZ7JjvBO/89fhDC3yJNnPdE97VUT9A9SEyNMF1m2WMCnY00VoCiUqDbF2cs8oxUcI9mPnfwXV/BF@wk8cEdI8U7cM3NuTsQrVGHXbJzn@WIAl0QilJbzKIjwt1EB79ESxSuRR2q7F6pBDlnTPCPNMfAr0E21oRldA/ucLZO3z5Q0irwESzSdChbH7ZqhkCPNJZEyCTPDj5PU6/k8mptEGPUN5VSOSl/aSoVt5TvWmIc3wfpZtecAwhX0x1naJRtfttFHbQIrJZcL5iFeHKmjQ4Uk8b0vAVtpqYucWbsZKqWo6FCJs2BYx6NrOOBQRScmbb@GJT7PN15EKOOY54zNrtets8dHGLzo6fCVjt8Tk9My6cTdM8lkJTX/LNy9m2QDjbaqEfQc@CBRml8C2um5yiDB8PlknoUtRvgNE76MYBjy6Oq7Hl1E9ZV8WGJe7IKAf3jgX6wtACqHF7ZHzzD0C7v0E6rmYRIuFoLx9QxHTr/yUAvrWyTVgj48VvcDuHA/gtEk@8n6x/a33mLxjSmksPK@Ldyv6KISUo@F3bkVfLRWnN7feZqH3Ycza/yBuYpfaOzp8uTb9vO5Dry0XL4N3OKypwe3IuaZfQjssHbECTSFY9vO3@SBt3m3jSMot2M9s@t1/viY7u@Xj48532ivaUn3CdeZ8485B02lx5OfP59iuLf0FUipcpStwOiOuCn8QhkxKmLg4@WkL/Jdt0Jv@kJvXhC66QvdvCD0ri/07gWh5cDU8ib1knuTPf0H "Kotlin – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 8 bytes
```
×» Ḣ¡»ø∧
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLDl8K7IOG4osKhwrvDuOKIpyIsIiIsIjciXQ==)
Port of 05AB1E. Uses canvas builtin.
## How?
```
×» Ḣ¡»ø∧
×        # Push asterisk
 » Ḣ¡»   # Push compressed integer 2064147 (translates to directions [→,↑,←,↓,↗,↓,↖])
      ø∧ # Canvas builtin with implicit input as the length, 2064147 as the directions, and asterisk as the character
```
]