VB编写程序,建立并输出一个10*10的矩阵,该矩阵两条对角线元素为1,其余元素均为0
3个回答
2013-07-06
展开全部
Private Sub Form_Click()
Dim a(1 To 10, 1 To 10) As Integer
For i = 1 To 10
For j = 1 To 10
a(i, j) = 0
If i = j Then a(i, j) = 1
If i + j = 11 Then a(i, j) = 1
Print a(i, j); " ";
Next j
Print
Next i
End Sub
Dim a(1 To 10, 1 To 10) As Integer
For i = 1 To 10
For j = 1 To 10
a(i, j) = 0
If i = j Then a(i, j) = 1
If i + j = 11 Then a(i, j) = 1
Print a(i, j); " ";
Next j
Next i
End Sub
推荐于2017-12-16
展开全部
矩阵对角线有两条一条是元素的两下标相等另一条是两下标的和对 11 取余为 0
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-07-06
展开全部
Private Sub Form_Click()
For i = 1 To 10
For j = 1 To 10
Print IIf(i = j Or i + j = 11, 1, 0);
Next j
Print
Next i
End Sub
For i = 1 To 10
For j = 1 To 10
Print IIf(i = j Or i + j = 11, 1, 0);
Next j
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询