VB里乘法口诀表的各种输出形式的程序代码

1个回答

  • '直角三角形的形式

    Dim i As Integer, j As Integer, se As String

    For i = 1 To 9

    For j = 1 To i

    se = i & "×" & j & "=" & i * j

    Print Tab((j - 1) * 9 + 1); se;

    Next j

    Print

    Next i

    '矩形的形式

    Dim i As Integer, j As Integer, se As String

    For i = 1 To 9

    For j = 1 To 9

    se = i & "×" & j & "=" & i * j

    Print Tab((j - 1) * 9 + 1); se;

    Next j

    Print

    Next i

    '等腰三角形的形式

    Dim i As Integer, j As Integer, se As String

    For i = 1 To 9

    Print Space((9 - i) * 5);

    For j = 1 To i

    se = i & "×" & j & "=" & i * j

    Print se; Space(3);

    Next j

    Print

    Next i