vb 编写一个矩阵,建立并输出一个10*10的矩阵,该矩阵对角线元素为1,其余元素均为0

如题所述

第1个回答  推荐于2017-05-17
private sub command_click()
dim a(10,10)
for i=1 to 10
for j=1 to 10
a(i,j)=0
next j,i

for i=1 to 10
a(i,i)=1
a(i,11-i)=1

next i

for i=1 to 10
for j=1 to 10
print a(i,j);
next j
print
next i
end sub本回答被网友采纳
相似回答