Magic squares of doubly even order: Difference between revisions

Content added Content deleted
m (→‎{{header|VBScript}}: Superfluous blanks suppressed)
m (→‎{{header|VBScript}}: Shorter version)
Line 1,229: Line 1,229:
i=0
i=0
For r=0 To n-1
For r=0 To n-1
line=""
l=""
For c=0 To n-1
For c=0 To n-1
bit=Mid(pattern, c\mult+(r\mult)*4+1, 1)
bit=Mid(pattern, c\mult+(r\mult)*4+1, 1)
If bit="1" Then t=i+1 Else t=size-i
If bit="1" Then t=i+1 Else t=size-i
line=line & Right(Space(w) & t, w) & " "
l=l & Right(Space(w) & t, w) & " "
i=i+1
i=i+1
Next 'c
Next 'c
wscript.echo line
wscript.echo l
Next 'r
Next 'r
wscript.echo "Magic constant=" & (n*n+1)*n/2</lang>
wscript.echo "Magic constant=" & (n*n+1)*n/2</lang>