Results 1 to 5 of 5

Thread: Multiplication Table

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    247
    what is the fastest way to make a multiplication table with less than 10 lines of code.
    Mako Shark
    Great White

  2. #2
    Guest
    This really isn't aligned well, but it demonstrates the basic idea. Add this code to a Form with a Label. Set the Font to a fixed width font (such as Courier New).
    Code:
    For X = 1 To 10
        For Y = 1 To 10
            Label1 = Label1 & "  " & X * Y
        Next Y
        Label1 = Label1 & vbCrLf
    Next X

  3. #3
    Guest

    Lightbulb This is better...

    Actually, use the following instead. You don't need a Label and it's perfectly aligned.

    Again, remember to use a Fixed With font.
    Code:
    For X = 1 To 10
        For Y = 1 To 10
            If (X * Y) < 10 Then Print "  " & (X * Y) & "  ";
            If (X * Y) >= 10 Then Print " " & (X * Y) & "  ";
        Next Y
        CurrentX = 0
        CurrentY = CurrentY + 240
    Next X

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    247
    Thanks Meg, but I forgot to mention that I also need it to start off with a zero.
    Mako Shark
    Great White

  5. #5
    Guest
    Instead of making it start from 1, make it start from 0.
    Code:
    For X = 0 To 10
        For Y = 0 To 10
            If (X * Y) < 10 Then Print "  " & (X * Y) & "  ";
            If (X * Y) >= 10 Then Print " " & (X * Y) & "  ";
        Next Y
        CurrentX = 0
        CurrentY = CurrentY + 240
    Next X

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width