发布网友 发布时间:2023-12-21 19:10
共1个回答
热心网友 时间:2024-01-15 05:18
Private Sub Command1_Click()
Dim a(20, 20) As Integer, n As Integer
n = InputBox("请输入一个奇数 N=")
Print "N="; n
i = 1
j = n \ 2 + 1
k = 1
For i1 = 1 To n
For i2 = 1 To n
a(i, j) = k
k = k + 1
If i2 < n Then
i = i - 1
j = j + 1
If i = 0 Then i = n
If j > n Then j = 1
Else
i = i + 1
End If
Next i2
Next i1
For i = 1 To n
For j = 1 To n
Print Tab(4 * j); a(i, j);
Next j
Next i
End Sub