Find all possible combinations of numbers to print given sum

The following program will print all possible combinations of additions from a given set of numbers so that they sum  up to a given target number

Sum Problem:

Input: X={n1,n2,n3,..n(s)}, G

Output= various combinations of X(n1..n(s)), where sum of X(n) = G

Solution:

This problem can be solved with a recursive combinations of all possible sums.

 

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
John_mmo Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
John_mmo
Guest
John_mmo

Hey, Thank you. It’s very helpful