-1

can anyone help me with this? i can get it to run but when i run it, the matrix doesnt execute correctly...i am writing it in "C"..this should be a 4x4 magic square...thanks~

```
#include <stdio.h>
#define R 4
#define C 4
void Same(int []);
int main()
{
int array[R][C], i, j, n[( R + R + 2)], out;
printf("\n * MAGIC * SQUARE *");
printf("\n\n\nThis program will ask for 16 numbers and it will store it in a matrix.");
printf("\nA magic square is an n by n matrix that is filled with numbers. The sum of");
printf("\neach row, column, and both diagonals have the same values.");
printf("\n\n\nPlease enter 16 integers below. Enter -1 to EXIT.\n");
for (i = 0; i < R; i++)
for (j = 0; j < C; j++);
{
scanf("%d", &array[i][j]);
if (array[i][j] == -1)
return 0;
}
for (i = 0; i < R; i++)
{
for (j = 0; j < C; j++)
printf("%d ", array[i][j]);
putchar("\n");
}
for (i = 0; i < R; i++)
{
out = 0;
for (j = 0; j < C; j++)
{
out = out + array[i][j];
}
n[i] = out;
}
for (j = 0; j < C; j++)
{
out = 0;
for (i = 0; i < C; i++)
{
out = out + array[i][j];
}
n[(j + R)] = out;
}
for (i = 0, out = 0; i < R; i++)
{
out = out + array[i][i];
}
n[( R + R )] = out;
for (i = 0, out = 0; i < R; i++ )
{
out = out + array[i][R - 1 - 1];
}
n[R + R + 1] = out;
Same(n);
return 0;
}
void Same(int total[])
{
int g = total[0], i;
for (i = 1; i < (R + R + 20; i++)
{
if (g != total[i] )
i = (R + R + 2);
}
if (i == (R + R + 3) )
printf("Not a Magic Square!\n\n");
else
printf("A Magic Square!\n\n");
}
```