用vb输出如图所示下三角单位矩阵,请把两个分开写。谢谢
发布网友
发布时间:2024-10-02 01:00
我来回答
共1个回答
热心网友
时间:2024-10-24 22:22
1. 创建VB工程,修改Caption属性为“下三角单位矩阵”
双击窗体,输入以下代码
Private Sub Form_Paint()
For I = 1 To 5
For J = 1 To I
Print "1 ";
Next J
For J = 1 To 5 - I
Print "0 ";
Next J
Print
Next I
End Sub
执行即可得到结果
2. 创建VB工程,双击窗体,输入以下代码
Private Sub Form_Paint()
a = 6
For I = 1 To 5
For j = 1 To I
Print a + j - 1; " ";
Next j
a = a + 5
Print
Next I
End Sub
执行即可
满意请及时采纳,谢谢