VB 打数字三角形
想要打出如下图形112112321……12345678987654321...
想要打出如下图形
1
1 2 1
1 2 3 2 1
……
1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1 展开
1
1 2 1
1 2 3 2 1
……
1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1 展开
展开全部
Private Sub Command1_Click()
Dim n As Integer
Dim i As Integer, j As Integer, k As Integer
n = InputBox("输入你要的行数")
For i = 1 To n
Print Tab(n * 2 - i);
For j = 1 To i
Print Trim(Str(j));
Next
For k = i - 1 To 1 Step -1
Print Trim(Str(k));
Next
Print
Next
End Sub
Dim n As Integer
Dim i As Integer, j As Integer, k As Integer
n = InputBox("输入你要的行数")
For i = 1 To n
Print Tab(n * 2 - i);
For j = 1 To i
Print Trim(Str(j));
Next
For k = i - 1 To 1 Step -1
Print Trim(Str(k));
Next
Next
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Form_Click()
Dim i As Long, j As Long, l As Long
l = 9
For i = 1 To l
Print Space(l - i);
For j = 1 To i * 2 - 1
Print CStr(j + CBool(j > i) * ((j - i) * 2));
Next j
Print
Next i
End Sub
Dim i As Long, j As Long, l As Long
l = 9
For i = 1 To l
Print Space(l - i);
For j = 1 To i * 2 - 1
Print CStr(j + CBool(j > i) * ((j - i) * 2));
Next j
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
长时间不做这东西,有点生疏,有麻烦的自己改改
'Option Explicit
Private Sub Form_Click()
For x = 1 To 9
For y = 1 To x
Print y;
Next y
For j = 1 To x-1
b = x - j
Print b;
Next j
Print
a = 1
Next x
Print
End Sub
'Option Explicit
Private Sub Form_Click()
For x = 1 To 9
For y = 1 To x
Print y;
Next y
For j = 1 To x-1
b = x - j
Print b;
Next j
a = 1
Next x
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询