Gamebot
Member
If I add three posative numbers to equal 19, keeping in mind 19 can be any number, I would like to know the best way to accomplish this for all possible numbers.
As of right now I have three for loops that simply check if: I + J + K = x. When x in this case is 19. It works fine and numbers wont go over 30 for my use. I have to wonder if checking that many values is the best way of doing it.
Thought someone with much better math skills especially in programming might have a better answer.
As of right now I have three for loops that simply check if: I + J + K = x. When x in this case is 19. It works fine and numbers wont go over 30 for my use. I have to wonder if checking that many values is the best way of doing it.
Thought someone with much better math skills especially in programming might have a better answer.