Author |
Message |
hpdudette
|
Posted: Tue May 27, 2003 6:18 pm Post subject: loop program |
|
|
how do i make a loop program so that in one loop from 1 to 80 the out put the number and square the number and display it like this:
Num Square Num Square Num Square Num Square
1 1 21 441 41 1681 61 3721
2 4 22 484 42 1764 62 3864
continue through
20 200 40 1600 60 3600 80 6400
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Blade
|
Posted: Tue May 27, 2003 6:33 pm Post subject: (No subject) |
|
|
i think this is what you want.... but i dont know how you want it displayed because that confused the hell outta me trying to read that question. plz try to be more clear lol or organize your data correctly
code: |
for i:1..20
put i, " ",i*2
end for
|
|
|
|
|
|
![](images/spacer.gif) |
krishon
|
Posted: Tue May 27, 2003 6:33 pm Post subject: (No subject) |
|
|
is this wut u want?
code: | for i : 1..80
put (i), " "..
put (i**2), " "..
delay (30)
end for
|
|
|
|
|
|
![](images/spacer.gif) |
Blade
|
Posted: Tue May 27, 2003 6:53 pm Post subject: (No subject) |
|
|
haha i beat you ![Very Happy Very Happy](http://compsci.ca/v3/images/smiles/icon_biggrin.gif) ![Very Happy Very Happy](images/smiles/icon_biggrin.gif) ![Very Happy Very Happy](images/smiles/icon_biggrin.gif)
|
|
|
|
|
![](images/spacer.gif) |
hpdudette
|
Posted: Tue May 27, 2003 6:54 pm Post subject: (No subject) |
|
|
sorry bout that the output should look like the attachment
Description: |
|
Filesize: |
10.81 KB |
Viewed: |
7077 Time(s) |
![pic.JPG pic.JPG](uploads/attachments/pic.JPG)
|
|
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Tue May 27, 2003 6:58 pm Post subject: (No subject) |
|
|
so its
code: |
for c:1..3
for r:1..20
locate(r,c*10)
put r+c*20
end for
end for
|
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
hpdudette
|
Posted: Tue May 27, 2003 7:14 pm Post subject: (No subject) |
|
|
thanks for your help u guys but its not suppose to look like that ... can n/e one else help
|
|
|
|
|
![](images/spacer.gif) |
Asok
![](http://www.battle.net/war3/images/neutral/units/animations/pandarenbrewmaster.gif)
|
Posted: Tue May 27, 2003 7:20 pm Post subject: (No subject) |
|
|
to be totally fair, you should be able to do the spacing yourself, you've been given the methods to find the values, you can figure out how to format it into whatever way you want. I'm not saying this to be mean but come on, at least try.
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
void
![](http://www.ci.oshkosh.wi.us/Fire/images/SKULL.GIF)
|
Posted: Tue May 27, 2003 8:00 pm Post subject: (No subject) |
|
|
i agree with asok...but i couldnt help feeling sorry for u...so i decided to get you started...the first 2 colums of stuff has been done....just use the same pattern to do the spacing...its little programs like this that end up helping you understand the easy crap so that in the future with major programs, you can focus on the harder shit
code: |
locate (1, 1)
put "NUM"
for a : 1 .. 20
locate (a + 1, 1)
put a : 3
end for
locate (1, 7)
put "SQUARE"
for a : 1 .. 20
locate (a + 1, 10)
put a ** 2 : 3
end for
|
|
|
|
|
|
![](images/spacer.gif) |
|