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

Ads
 

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??
how to print all colors using awt
Advertisements
I want to know the all possible syntax for EL code to print the first element of an array.
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
all combination via recursive function
ModuleNotFoundError: No module named 'zerofs'
array find all possible dimension
ModuleNotFoundError: No module named 'zerodb'
ModuleNotFoundError: No module named 'zeropy'
ModuleNotFoundError: No module named 'zerorm'
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'
How to calculate sum of HH:MM:SS Format?
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?
how to print spark dataframe data
how to print spark dataframe data
How to print this in java?
how to print the server time
how to print String as pattern ?
ModuleNotFoundError: No module named 'nester_print_all'
ModuleNotFoundError: No module named 'zerovm-sphinx-theme'
javascript:getElementByClassname:Is it possible to collect all the elements with same classname

Ads