What if i have some integers (lets say 1 5 8 7 2 3 4 9 5 8 3 4 7 0) (uknown ammount or values of integers) and i want to use some of 'em to sum up to a number or close to it (closer = better) (lets say 20). When i say uknown values, i mean that the values would be inputted from a .txt file (random integer). How do i do that?
Comments
:
Use a while-do loop to read them, and immediately add them to the sum.