Computer Science Canada how do i solve this loop |
Author: | hpdudette [ Thu May 22, 2003 6:57 pm ] |
Post subject: | how do i solve this loop |
this is the problem: write a program containing an infinite loop which out puts a series of integers starting at 5 and going up by 5 |
Author: | kythoon [ Thu May 22, 2003 7:01 pm ] | ||
Post subject: | |||
i think this is what u want |
Author: | Catalyst [ Thu May 22, 2003 7:02 pm ] |
Post subject: | |
not gonna solve for u but heres a hint, use a loop its REALLY simple 5 lines max note: kythoon posted while i was posting |
Author: | hpdudette [ Thu May 22, 2003 7:02 pm ] |
Post subject: | |
![]() ![]() ![]() ![]() ![]() ![]() |
Author: | netninja [ Mon Feb 16, 2004 7:55 am ] |
Post subject: | |
Would it not be easier to make it count 'by '5's instead of +5??? Its not even sarcasm, i'd like to know. If the numbers start getting big, will the program count faster 'by' numbers, or + the numbers?? |
Author: | Tony [ Mon Feb 16, 2004 8:57 am ] |
Post subject: | |
![]() and the answer is no ![]() |
Author: | Cervantes [ Mon Feb 16, 2004 3:45 pm ] | ||
Post subject: | |||
Well I think you learned a bit from my tutorial ![]() The 'by 5' you are getting from a for loop when you do something like this
That would work, except you can't use for loops in this problem because it asks to repeat an infinate number of times. Loops = go on forever until the exit when statement is true for loops = repeat a defined number of times. (can't set it to be 1 .. infinity) |
Author: | netninja [ Tue Feb 17, 2004 6:57 pm ] |
Post subject: | |
Yes, that was my question i think, if it was possible to do an infinite loop with the 'by', but i soon realized i had to do the num:=num+5 method. I already understand that. But thanks anyway. |
Author: | netninja [ Wed Feb 18, 2004 4:08 pm ] |
Post subject: | |
How do you make a loop that generates random integers. My code isnt good at all. I tried doing a for loop, like 1..5, (so i generate 5 random numbers) and randint, but my code is all wrong, 0 % accurate. Can someone help me with that? |
Author: | Cervantes [ Wed Feb 18, 2004 4:20 pm ] | ||||
Post subject: | |||||
or if you want to use a for loop
|
Author: | netninja [ Wed Feb 18, 2004 8:44 pm ] |
Post subject: | |
But i would like to make it give 5 random integers. I already know how to put 1 ![]() Thanks again |
Author: | TheZsterBunny [ Thu Feb 19, 2004 8:21 am ] | ||
Post subject: | This may be too late but, | ||
This is something you could use
That would work quite well, but arrays take up a great deal of space. -z0rQ |