欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

VB打印九九乘法表

程序员文章站 2024-03-25 14:04:28
...

##左下角

Private Sub Command1_Click()
Print Tab(50); "9x9 乘法口诀表"
For i = 1 To 9
For j = 1 To i
Print "  " & i & "x" & j & "=" & i * j,
Next j
Print ""
Next i
End Sub

结果:
VB打印九九乘法表
##左上角

Private Sub Command1_Click()
Print Tab(50), "9x9 乘法口诀表"
Dim i, j As Integer
For i = 1 To 9
  For j = i To 9
   Print i; "*"; j; "="; i * j,
 Next j
   Print ""
Next i
End Sub

结果:
VB打印九九乘法表
##右上角

Private Sub Command1_Click()
Print Tab(60); "9x9 乘法口诀表"
Dim i, j, k, s As Integer
For i = 1 To 9
   For j = 1 To i - 1
   Form1.Print "",
       Next j
' Print "",
   For k = i To 9
   s = i * k
   Form1.Print i; "x"; k; "="; s,
       Next k
  Print ""
    Next i
End Sub

结果:
VB打印九九乘法表
##右下角

Private Sub Command1_Click()
Print Tab(60), "9x9  乘法口诀表"
Dim i, j, k As Integer
For i = 1 To 9
   For j = i To 9
   Print "",
   Next j
   k = 10 - i
   For j = 1 To i
   Print i; "*"; k; "="; i * k,
   k = k + 1
   Next j
   Print ""
Next i
End Sub

结果:
VB打印九九乘法表

相关标签: VB 编程语言