Quote:
It works for inputs: 1,3,5,7,9 and 11. But it doesn´t work for 13 and 15.
You are on the wrong way. Once you fixed the code for 13 and 15, you will have to fix it for 17 and 19. And the main reason why it don't work for even numbers is that your code do not handle it.
There is another way which will handle even and odd numbers at once.
Build a 2D array of chars.
Fill the array with '.'
Set square limits 0,0 and n-1,n-1
Loop as long as spiral is not finished
Draw outer loop of spiral in order (use 1 loop per line)
Reduce square
Print 2D array