A magic square is a box (with n rows and n columns), with numbers from 1 x (nxn) used.
N may be even or odd. There is no known algorithm to make any even numbered square, but there is an algorithm for making an odd numbered square. Let me show you how to make a 3x3 magic square. Later you can try to make 5x5 or 7x7 etc.
Start with top centre, and put 1 here. Let us call this as location(1,2) where 1 is row and 2 is column.
From this location (1,2) we go top and left. Reduce row by 1 and col by 1. This gives us row=0, and col=1. There is no row=0, so we put row=3 (last row). We put in this location (3,1)=2
Top left of location (3,1) will be location (2,0). There is no column 0 so we take column as 3 (last column). Hence in location (2,3)=3
Top left of this location (2,3) will be location (1,2). But at this place we already have number 1. In such a case we go back to the original location (2,3) and go one column down. This is location (3,3). Here we put 4.
Top left from location (3,3) is location (2,2)=5
Top left from location (2,2) is location (1,1)=6
Top left from location (1,1) is location (0,0). There is no such location, so we change to location (3,3), the last row and last column. But there is already a number here, “4”. So we go back to the original location (1,1) and come 1 step down to location (2,1). Here we put 7.
Top left from location (2,1) is location (1,0), no col 0, so get location(1,3). Here we put 8.
Top left from location (1,3) is location (3,2)=9
Try adding rows (6+1+8) or (7+5+3) or (2+9+4)
Or columns (6+7+2) or (1+5+9) or (8+3+4) or
Diagonally (6+5+4) or (2+5+8). The sum is always 15.
So try for a 5x5 square and a 7x7 square and post it here.