Computer Science Canada

multiplcation table

Author:  mercuryy [ Wed Mar 02, 2005 5:47 pm ]
Post subject:  multiplcation table

How can you make a multiplicaiton table using turing loop structure.

e.g. 1 2 3 4 5 6 7
2 4 6 8 10 12 14
3 6 9 12 15 18 21

thanks in advance

Author:  person [ Wed Mar 02, 2005 5:49 pm ]
Post subject: 

this is actually quite easy

code:

for x : 1 .. 9
    for y : 1 .. 9
        put x * y
    end for
end for

Author:  mercuryy [ Wed Mar 02, 2005 5:51 pm ]
Post subject: 

yea. i know how to calculate the result. but i'am not sure how to make it the position that i wanted to be in my post.

Author:  mercuryy [ Wed Mar 02, 2005 5:58 pm ]
Post subject: 

like this:

1 2 3 4
2 4 6 8
3 6 9 12

Author:  person [ Wed Mar 02, 2005 6:11 pm ]
Post subject: 

code:

var b := 0
var a := 1
for x : 1 .. 9
    for y : 1 .. 9
        b += 2
        locate (a, b)
        put x * y
        if b = 8 then
            b := 0
            a += 1
        end if
    end for
end for


i dont know if its wat u want

hope this helps

Author:  Flikerator [ Wed Mar 02, 2005 6:21 pm ]
Post subject: 

mercuryy wrote:
like this:

1 2 3 4
2 4 6 8
3 6 9 12


That is a strange way to do a multiplication table...

Author:  person [ Wed Mar 02, 2005 6:35 pm ]
Post subject: 

its wat he wants though

Author:  Andy [ Wed Mar 02, 2005 6:38 pm ]
Post subject: 

errr wtf is that?

code:

for x : 1 .. 9
    for y : 1 .. 9
        put x * y : 3..
    end for
    put ""
end for

Author:  mercuryy [ Wed Mar 02, 2005 6:40 pm ]
Post subject: 

actually this is not exable what i want. Embarassed . but thanks for trying. Look at


http://renew.education.ucsb.edu/downloads/overheads_handouts/MultiplicationTable.jpg


for the multiplication i want. Laughing

Author:  mercuryy [ Wed Mar 02, 2005 6:47 pm ]
Post subject: 

actually. sorry guys. I got it. it is just a calculating mistake. thank you all who tries to help. Embarassed

Author:  person [ Wed Mar 02, 2005 7:07 pm ]
Post subject: 

Quote:

errr wtf is that?

Code:

for x : 1 .. 9
for y : 1 .. 9
put x * y : 3..
end for
put ""
end for


i truely feel stupid right now

Author:  Flikerator [ Wed Mar 02, 2005 7:09 pm ]
Post subject: 

Why you feel stupid? Mercuryy made it sound like he wanted some sort of wierd looking table, and it turned out to be a normal muliplication table...

Author:  jamonathin [ Wed Mar 02, 2005 10:24 pm ]
Post subject: 

picky, picky, mercuryy...

Author:  person [ Thu Mar 03, 2005 4:17 pm ]
Post subject: 

i felt stupid becasue my code was sooo long.....long......long....and stupid

Author:  jamonathin [ Fri Mar 04, 2005 6:44 am ]
Post subject: 

don't feel dumb cuz u tried sumthin

Author:  Drakain Zeil [ Fri Mar 04, 2005 6:58 am ]
Post subject: 

Don't worry about it, I overcomplicate things all the time because it's the first thing that I think of v.v

Author:  illu45 [ Wed Mar 09, 2005 6:12 pm ]
Post subject: 

Heh.. yeah, I treid to make one and I had like 6 for loops, and I was using locate command... So... yeah, I really overcomplicated that one Smile...

The only problem is with Andy's code is that if you go into 2-digi numbers (a 12 x 12 table), the numbers tend to be too close together. (e.g. 10*10 = 90100110 etc. And it becomes difficult to differentiate. Though that can be fixed by changing
code:
put x * y : 3..
to
code:
put x * y : 4..

Author:  ssr [ Wed Mar 09, 2005 9:19 pm ]
Post subject: 

ummm r we doing his hwk or something?
but anyway
help eh
Smile 8)

Author:  Token [ Thu Mar 10, 2005 11:52 am ]
Post subject: 

Hmm i would have thaught to use a locate command also, but that seems to get the job done quite well, after seing this i'm working on adding more code to make it so that when your mouse is over one of the columns it highlights it yellow, that way you can find where they meet easier, i'll post it here when i'm done


: