Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 8 Online
OpenStudy (anonymous):

I have a problem thinking how to answer ps2 first question. I can write down answer on paper but I'd rather write a program that would show me combinations. Can someone help?

OpenStudy (anonymous):

I was thinking to start from 1 and create a loop that would be incrementing the value by 6, 9 and 20 but there must be more elegant way to answer it.

OpenStudy (anonymous):

I don't want to give any answers away, but you could go through each number combination and use for loops to get the other mix/matches. I.e. 6, 12, 18 etc

OpenStudy (anonymous):

You don't really need to answer question 1 and 2. As long as you understand how and why the theorem works you can skip them and go straight to question 3(which is to make a program). But as he said you should make a loop that tries out different combinations. :)

OpenStudy (anonymous):

or, nested loops

OpenStudy (anonymous):

exactly, but I was trying not to mention that

OpenStudy (anonymous):

Yeah I figured it out eventually but was hoping for more elegant way to do this not this brute force approach.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!