how to print all possible combination that sum to zero??

how to print all possible combination that sum to zero??

? 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

Ads









Related Tutorials/Questions & Answers:
how to print all possible combination that sum to zero??
I want to know the all possible syntax for EL code to print the first element of an array.
Advertisements
ModuleNotFoundError: No module named 'combination_all'
ModuleNotFoundError: No module named 'combination_all'
ModuleNotFoundError: No module named 'combination_all'
print the sum of even number from 1 to 100
how to print all colors using awt
ModuleNotFoundError: No module named 'zerofs'
ModuleNotFoundError: No module named 'zeropy'
ModuleNotFoundError: No module named 'zerorm'
all combination via recursive function
array find all possible dimension
ModuleNotFoundError: No module named 'zerodb'
How do you sum a dictionary
sum of all values in a column of jtable
ModuleNotFoundError: No module named 'gevent_zeromq'
ModuleNotFoundError: No module named 'gevent_zeromq'
ModuleNotFoundError: No module named 'zeroae-cli'
ModuleNotFoundError: No module named 'zeroae-goblet'
ModuleNotFoundError: No module named 'zerodb-server'
ModuleNotFoundError: No module named 'zerovm-sphinx-theme'
How to calculate sum of HH:MM:SS Format?
sum
how to print the server time
how to find the sum of integers in a string of sentence in java
How to print this Format exactly?
javascript:getElementByClassname:Is it possible to collect all the elements with same classname
ModuleNotFoundError: No module named 'nester_print_all'
How to print this in java?
how to print the server time
how to print String as pattern ?

Ads