Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 loop program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hpdudette




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Blade




PostPosted: 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
krishon




PostPosted: 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
Blade




PostPosted: Tue May 27, 2003 6:53 pm   Post subject: (No subject)

haha i beat you Very HappyVery HappyVery HappyVery Happy
hpdudette




PostPosted: Tue May 27, 2003 6:54 pm   Post subject: (No subject)

sorry bout that the output should look like the attachment


pic.JPG
 Description:
 Filesize:  10.81 KB
 Viewed:  4068 Time(s)

pic.JPG


Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
hpdudette




PostPosted: 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
Asok




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
void




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: