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

用VB的FOR循环结构编写数字金字塔,用print打印出来。题目:编写程序,打印如下所示的“数字金字塔” 1 121 12321 1234321 123454321 12345654321 1234567654321 12345678765432112345678987654321

第1个回答  推荐于2018-04-11

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个回答  2013-05-12
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个回答  2018-04-11
我试了一下,不对呀?怎么回事?

用VB编程如何打印数字金字塔
For i = 1 To 9 For j = 1 To 9 - i Print " "; Next j For j = 1 To i Print j; Next j For j = i - 1 To 1 Step -1 Print j; Next j Print Next i

用VB的循环结构编写数字金字塔
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

vb问题 打印数字金字塔的一段代码,请哪位给我解释一下,要详细一点...
Private Sub Form_DblClick() ‘窗体双击事件 For i = 1 To 9 ’外层循环,用于控制打印行数 For T = 1 To i ‘内层循环,用于控制每行的打印列数 Print Tab(10 - i); ’定位首个打印字符的位置。这里可以使用spc(10-i),可以获得相同的效果 Next For j = 1 To i ‘打印字符 Print...

用vb编写数字金字塔 并且每行的数字要相同
Print "n="; n For i = 1 To n Print Tab(n + 1 - i);For j = 1 To 2 * i - 1 Print Chr(48 + i);Next j Print Next i End Sub

用VB编写程序,绘制出如下图所示数字金字塔
楼主,试试这个:Private Sub Command1_Click() Dim i&, j& Me.Cls For i = 1 To 3 Print Space$(4 - i); j = i - 1 For j = -j To j Print CStr((i - Abs(j)) ^ 2); Next Print NextEnd Sub ...

vb数字金字塔1 121 12321一直到9
Private Sub Form_Click()Dim a(1 To 5) As Integer For j = 1 To 5 a(j) = j Next j For i = 1 To 5 Print Tab(30 - i * 3);For j = 1 To 2 * i - 1 If j > i Then Print a(2 * i - j);Else Print a(j);End If Next j Next i End Sub 望采纳!!!

vb程序设计打印数字金字塔
Private Sub Form_Load()Me.AutoRedraw = True For i = -4 To 4 Print Tab(3 + Abs(i)); String(9 - 2 * Abs(i), Trim(Str(i + 5)))Next i End Sub

VB中如何计算税后金额并输出数字金字塔??
tax = 8000 * 0.05 bbb = (aaa - 10000) * 0.12 End If If aaa > 50000 Then tax = tax + 40000 * 0.12 bbb = (aaa - 50000) * 0.3 End If If aaa > 100000 Then tax = tax + 50000 * 0.3 bbb = (aaa - 100000) * 0.45 End If MsgBox "税前金额:" & aaa &...

关于VB数字金字塔
Print Trim(j); Next PrintNextFor i = 8 To 1 Step -1 Print Space(i - 1); For j = 1 To 10 - i Print Trim(j); Next For j = 9 - i To 1 Step -1 Print Trim(j); Next PrintNextEnd Sub ...

用vb编写打印倒立的数字金字塔,急求。
Private Sub Form_Click()Dim i As Integer, s As String For i = 9 To 0 Step -1 s = String(i * 2 + 1, CStr(i))Print Spc((18 - i * 2) \/ 2);s Next End Sub

相似回答