hi,
i am having trouble with making a program that will tell you the number of ways you can do something. for example, say there are 5 numbers, 8,1,2,1,6 and i have to add them and make 10, using the least numbers. so, 8+2=10, 8+1+1=10, 6+1+1+2=10. in this case, 8 and 2 are the numbers i want to output because they make ten and only 2 numbers are used.8+1+1 and 6+1+1+2 are more than 2 numbers, so, 8+2 will be chosen over them. how can i write a program for this. (in this case it asks for the least amount of numbers, i am having trouble figuring out the most number of combinations as well). thanx a lot.
i am having trouble with making a program that will tell you the number of ways you can do something. for example, say there are 5 numbers, 8,1,2,1,6 and i have to add them and make 10, using the least numbers. so, 8+2=10, 8+1+1=10, 6+1+1+2=10. in this case, 8 and 2 are the numbers i want to output because they make ten and only 2 numbers are used.8+1+1 and 6+1+1+2 are more than 2 numbers, so, 8+2 will be chosen over them. how can i write a program for this. (in this case it asks for the least amount of numbers, i am having trouble figuring out the most number of combinations as well). thanx a lot.