I posted earlier tonight. You can view my original post here: Help with writing a program that creates an odd n*n magic square where n is....

So, now everything works fine, but the problem left is that my code will compile and run, but instead of printing my output as a square it prints it in a vertical column: For example if I wanted my magic square to be 3 it would print:

8

1

6

3

5

7

4

9

2

**Also I have tried placing my 'break;' in my program, but it doesn't seem to be working.

Thank you!

Here is my updated code:

Code:#include <stdio.h>#define array_size 15 int main (void) { int row, column, size, n = 2, magic_square [array_size][array_size]; for ( ; ; ) { printf ("Enter size of magic square: "); scanf ("%d", &size); if (size % 2 == 0) printf ("Enter an odd number!\n"); else if (size <= 0 || size > 15) printf ("Enter a number between 1 and 15!\n"); else { magic_square [size][size]; for (row = 0; row < size; row++) for (column = 0; column < size; column++) magic_square [row][column] = 0; row = 0; column = (size/2); magic_square [row][column] = 1; for (n; n<= size*size; n++) { if (--row < 0) row = (size -1); if (++column > size -1) column = 0; if (magic_square [row][column] != 0) { if (++row > (size -1)) row = 0; if (--column < 0) column = size - 1; while (magic_square [row][column] != 0) if (++row > (size -1)) row = 0; } magic_square [row][column] = n; } for (row = 0; row < size; row++) for (column = 0; column < size; column++) printf ("%4d\n", magic_square [row][column]); printf ("\n"); } } return 0; }