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









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'
how to print all colors using awt
print the sum of even number from 1 to 100
ModuleNotFoundError: No module named 'zerofs'
ModuleNotFoundError: No module named 'zeropy'
ModuleNotFoundError: No module named 'zerorm'
ModuleNotFoundError: No module named 'zerodb'
all combination via recursive function
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'
ModuleNotFoundError: No module named 'gevent_zeromq'
ModuleNotFoundError: No module named 'gevent_zeromq'
array find all possible dimension
sum of all values in a column of jtable
How do you sum a dictionary
Java Print the all components
it possible or not
how to print the server time
How to calculate sum of HH:MM:SS Format?
How to print this Format exactly?
sum
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 ?
javascript:getElementByClassname:Is it possible to collect all the elements with same classname
Find consecutive numbers whose sum is equal to input number.
sum
how to print - Java Beginners
how to find the sum of integers in a string of sentence in java
How to print UIButton id
how to print spark dataframe data
how to print spark dataframe data
ModuleNotFoundError: No module named 'odoo8-addon-account-tax-report-no-zeroes'
ModuleNotFoundError: No module named 'odoo8-addon-account-tax-report-no-zeroes'
how to print the following pattern
Itried all possible ways still getting thesame error
how to print pdf format
Find sum of all the elements of matrix using Java
sum
How to design a foot print on the sand, print on the sand, print
how to print JInternal frame component ?
How to use sum sql query to process the summed data into a list?
How to use sum sql query to process the summed data into a list?

Ads