Magic squares of odd order: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add Cowgol) |
Not a robot (talk | contribs) (Add VTL-2) |
||
Line 5,182: | Line 5,182: | ||
The magic number is: 369 |
The magic number is: 369 |
||
</pre> |
</pre> |
||
=={{header|VTL-2}}== |
|||
{{trans|C}} |
|||
<lang VTL2>10 N=1 |
|||
20 ?="Magic square of order "; |
|||
30 ?=N |
|||
40 ?=" with constant "; |
|||
50 ?=N*N+1/2*N |
|||
60 ?=":" |
|||
70 Y=0 |
|||
80 X=0 |
|||
90 ?=Y*2+N-X/N*0+%*N+(Y*2+X+1/N*0+%+1 |
|||
100 $=9 |
|||
110 X=X+1 |
|||
120 #=X<N*90 |
|||
130 ?="" |
|||
140 Y=Y+1 |
|||
150 #=Y<N*80 |
|||
160 ?="" |
|||
170 N=N+2 |
|||
180 #=7>N*20</lang> |
|||
{{out}} |
|||
<pre>Magic square of order 1 with constant 1: |
|||
1 |
|||
Magic square of order 3 with constant 15: |
|||
2 9 4 |
|||
7 5 3 |
|||
6 1 8 |
|||
Magic square of order 5 with constant 65: |
|||
2 23 19 15 6 |
|||
14 10 1 22 18 |
|||
21 17 13 9 5 |
|||
8 4 25 16 12 |
|||
20 11 7 3 24 |
|||
Magic square of order 7 with constant 175: |
|||
2 45 39 33 27 21 8 |
|||
18 12 6 49 36 30 24 |
|||
34 28 15 9 3 46 40 |
|||
43 37 31 25 19 13 7 |
|||
10 4 47 41 35 22 16 |
|||
26 20 14 1 44 38 32 |
|||
42 29 23 17 11 5 48</pre> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |