Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C programming project
#1
Language of coding is C only. No other language is allowed for this.

You will be given a file with two lines. First line will contain two integers separated by commas(say X,Y). In the next line there will be Y number of integers again separated by commas. You should be able to output all the possible combinations from the Y integers (an integer can be used infinite number of times) which addition will give the value X.

Example Input

10,4
2,5,3,6

The output will be:
2+2+2+2+2
2+2+3+3
2+2+6
2+3+5
5+5

The order of the output does not matter
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)