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

2024年11月28日 07:42
有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):

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