VB打印九九乘法表

it2025-01-14  4

##左下角

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

结果: ##左上角

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

结果: ##右上角

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

结果: ##右下角

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

结果:

最新回复(0)