Home Answers Viewqa Java-Beginners how to print all possible combination that sum to zero??

 
 


spencer
how to print all possible combination that sum to zero??
1 Answer(s)      a year and a month ago
Posted in : Java Beginners

Ã? Consider the sequence of digits from 1 through N (N<=9) in increasing order: 1 2 3 4 ââ?¬Â¦ N Ã?Â

Insert either a ââ?¬Ë?+' (for addition) or a ââ?¬Ë?-ââ?¬Ë? (for subtraction) between each of the digits so that the resultant sum is zero. Print all possible combinations that

sum to zero

Example
Enter a num : 7
1+2-3+4-5-6+7=0
1+2-3-4+5+6-7=0
1-2+3+4-5+6-7=0
1-2-3-4-5+6+7=0
View Answers

April 18, 2012 at 7:31 PM


Consider the sequence of digits from 1 through N(N<=9) in increasing order :1 2 3 4....N Insert either a '+'(for addition) or a '-'(for subtraction) between each of the digits so that the resultant sum is zero. Print all posible combinations that sum to zero. Example: Enter a num : 7 1+2-3+4-5-6+7=0 1+2-3-4+5+6-7=0 1-2+3+4-5+6-7=0 1-2-3-4-5+6+7=0









Related Pages:
sum
sum

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.