dim a(4,4) as integer,s as integer
s=0
a(1,1)=15
a(1,2)=30
a(1,3)=70
a(1,4)=11
a(2,1)=14
a(2,2)=25
a(2,3)=90
a(2,4)=100
a(3,1)=77
a(3,2)=8
a(3,3)=21
a(3,4)=30
a(4,1)=55
a(4,2)=40
a(4,3)=31
a(4,4)=52
for i=1 to 4
print a(i,i)
next i'输出一条对角线的数
for i=1 to 4
print a(i,4-i)
next i'输出另一条对角线的数
for i=1 to 4
for j=1 to 4
s=s+a(i,j)
next j
print s'输出各行和
s=0
next i
for i=1 to 4
for j=1 to 4
s=s+a(j,i)
next j
print s'输出各列和
s=0
next i
'最后那个交换就不写了,手打很麻烦、就和两个变量交换的原理一样。望采纳、