用VB的循环结构编写数字金字塔

2024-11-28 07:42:37
推荐回答(3个)
回答1:

Private Sub Command1_Click()

For i = 1 To 9

Print Spc(9 - i);

For j = 1 To i

Print Chr(48 + j);

Next j

For j = i - 1 To 1 Step -1

Print Chr(48 + j);

Next j

Print

Next i

End Sub

回答2:

dim I as integerdim j as integerdim b as integer for i=1 to 9 '打印空格 for b=i to 9 print space(b) next '打印数字 for j=1 to i print j & "" next for j=i-1 to 1 print j & "" next'换行printnext

回答3:

我试了一下,不对呀?怎么回事?