Magic squares of doubly even order: Difference between revisions
Content added Content deleted
(→{{header|REXX}}: added the REXX language.) |
m (→{{header|REXX}}: added an article ("the") to the last line of the output.) |
||
Line 91: | Line 91: | ||
gen: #=0; do r=1 for n; do c=1 for n; #=#+1; @.r.c=#; end; end; return |
gen: #=0; do r=1 for n; do c=1 for n; #=#+1; @.r.c=#; end; end; return |
||
show: #=0; do r=1 for n; $=; do c=1 for n; $=$ right(@(r,c),w); end; say $; end; return |
show: #=0; do r=1 for n; $=; do c=1 for n; $=$ right(@(r,c),w); end; say $; end; return |
||
sum: #=0; do r=1 for n; #=#+@(r,1); end; |
sum: #=0; do r=1 for n; #=#+@(r,1); end; say; say 'The magic number is: ' #; return |
||
max#: do a=n to 1 by -1; do b=n to 1 by -1; if @.a.b>0 then return; end; end |
max#: do a=n to 1 by -1; do b=n to 1 by -1; if @.a.b>0 then return; end; end |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
Line 116: | Line 116: | ||
57 58 6 5 4 3 63 64 |
57 58 6 5 4 3 63 64 |
||
magic number is: 260 |
The magic number is: 260 |
||
</pre> |
</pre> |
||