大众信息网

VB编写程序,打印如下所示的数字金字塔

关注:58  答案:2  手机版
解决时间 2021-01-27 13:32
,数字金字塔如图
1
22
333
4444
55555
666666
7777777
88888888
999999999
最佳答案
Private Sub Command1_Click() Dim i As Integer Dim j As Integer Dim s As String For i = 1 To 9 s = Space((9 - i) * 2) For j = -(i - 1) To i - 1 s = s & i - Abs(j) & " " Next Print s Next End Sub
全部回答
private sub command1_click() dim str as string for i = 1 to 9 for j = 1 to i * 2 - 1 str = str & 10 - i next j print str str = "" next i end sub
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!