Question: This is a C code, please comply with the guitelines on the red rectangle. Thank you Write a function that creates and displays an n

This is a C code, please comply with the guitelines on the red rectangle. Thank you
Write a function that creates and displays an n x n magic square for any odd n between 3 and 19 inclusive. An n x n magic square is a square grid filled with the distinct positive integers 1, 2 n2 such that the sum of the integers in each row, column, and diagonal is equal Store your magic square in a two-dimensional array with 20 rows and 20 columns Fill your magic square by placing the number 1 in the middle of row 0. Place the remaining integers by moving up 1 row (towards a lower subscript) and over one column (towards a higher subscript). Any attempt to go outside the bounds of the grid should wrap around to the opposite edge of the grid. For example when you attempt to go up 1 row to place 2, we wrap around to row n - 1 (the last row). If the cell is already occupied, put the number in the cell directly below the cell filled with the previous value. Continue by going up 1 and over 1 from there Write a driver for your function that gets a value of n from the user and calls a function named fillMagicSquare to fill in the array with the values for the magic square and then prints the magic square on the screen. Don't forget n must be a positive odd integer between 3 and 19 Your fillMagicSquare function must be prototyped as follows void fillMagicsquare (int square ] [20], int n) magic square for n 5 should be Sample Output: 17 24 1 815 23 5 714 16 4 6 13 20 22 10 12 19 21 3 11 18 25 29 The magic square for n 9 should be Sample Output: 47 58 69 80 1 12 23 34 45 57 68 79 9 11 22 33 44 46 67 78 8 10 21 32 43 54 56 77 7 18 20 31 42 53 55 66 6 17 19 30 41 52 63 65 76 16 27 29 40 51 62 64 75 5 26 28 39 50 61 72 74 415 36 38 49 60 71 73 3 14 25 37 48 59 70 81 2 13 24 35 You may NOT call anything from the library in your functions. You may test your strlen and strncat functions by comparing the results produced with those produced by the library versions. You will need to create a driver to test your functions. We will be testing your functions with our driver. We will NOT be including the string.h header file in our program. Again your functions must work without using anything from the library! .Begin the body of a while or for loop on the line below the loop header .Begin the body of a do-while loop on the line below the key word do. Indent the statements in the body of a loop one level from the key word that marks the beginning of the loop. Write your loops so that it is clear from the loop continuation expression when the loop iterates and when it terminates Do not use a call to the exit function to terminate the iterations of a loop Do not use a return statement to exit a loop -Do not use a break to exit a loop. - Do not use continue in your loops Do not put statements in the body of a for loop that change the value of the variable(s) used to control the iterations of the loop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
