Loop help edkened!!! urgent
Author |
Message |
edkedned
|
Posted: Fri Jan 22, 2010 6:13 pm Post subject: Loop help edkened!!! urgent |
|
|
Write a short program that outputs a number between 1 and 200 that are divisible by 7 and 8 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
jbking
|
Posted: Fri Jan 22, 2010 6:45 pm Post subject: Re: Loop help edkened!!! urgent |
|
|
There's a few different ways to interpret that last part, IMO:
1. Output 56,128, 184. Those are the 3 values between 1 and 200 that are divisible by 56 which is the product of 7 and 8 as the values share no common factors. Note that this can be just one line and thus is nearly the shortest program possible, if size is the way to get the top mark.
2. Output a pair of lists, one for all the 7s and one for all the 8s. This may not be what is desired and does have duplicates that can occur along with using a pair of lists rather than just one.
3. Manually go through a for loop and do a sort of "FizzBuzz" approach to the problem.
I think that is being somewhat useful though hopefully not overwhelming your teacher. |
|
|
|
|
|
Insectoid
|
Posted: Fri Jan 22, 2010 7:41 pm Post subject: RE:Loop help edkened!!! urgent |
|
|
First, you write your topic in English. 'Edkened' is not an English word.
The way you wrote your post, I gather you want us to write your program for you. Not gonna happen.
Look into the 'mod' function. |
|
|
|
|
|
|
|