编程输出对角线元素为0,上三角元素为1,下三角元素为1的5×5方阵如下图(代码写在form1_cl

2024-12-27 13:32:33
推荐回答(1个)
回答1:

Private Sub Form_Click()

  Form1.FontSize = 16

  Dim a(5, 5) As Integer

  For i = 1 To 5

    For j = 1 To 5

      If i = j Then a(i, j) = 0 Else a(i, j) = 1

    Next j

  Next i

  For i = 1 To 5

    For j = 1 To 5

      Print a(i, j);

    Next j

    Print

  Next i  

End Sub