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

Username:   Password: 
 RegisterRegister   
 Loop help edkened!!! urgent
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
edkedned




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




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




PostPosted: 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.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: