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?
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.
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
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. :)
or, nested loops
exactly, but I was trying not to mention that
Yeah I figured it out eventually but was hoping for more elegant way to do this not this brute force approach.
Join our real-time social learning platform and learn together with your friends!