|
-
Nov 16th, 2000, 05:38 PM
#1
Thread Starter
Addicted Member
what is the fastest way to make a multiplication table with less than 10 lines of code.
-
Nov 16th, 2000, 05:50 PM
#2
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
-
Nov 16th, 2000, 05:58 PM
#3
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
-
Nov 16th, 2000, 07:16 PM
#4
Thread Starter
Addicted Member
Thanks Meg, but I forgot to mention that I also need it to start off with a zero.
-
Nov 16th, 2000, 07:22 PM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|