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'
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'
how to print all colors using awt
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'
array find all possible dimension
ModuleNotFoundError: No module named 'gevent_zeromq'
ModuleNotFoundError: No module named 'gevent_zeromq'
sum of all values in a column of jtable
How do you sum a dictionary
Java Print the all components
it possible or not
sum
ModuleNotFoundError: No module named 'nester_print_all'
Find consecutive numbers whose sum is equal to input number.
javascript:getElementByClassname:Is it possible to collect all the elements with same classname
how to print the server time
How to calculate sum of HH:MM:SS Format?
sum
How to print this Format exactly?
How to print this in java?
how to print the server time
how to print String as pattern ?
ModuleNotFoundError: No module named 'odoo8-addon-account-tax-report-no-zeroes'
ModuleNotFoundError: No module named 'odoo8-addon-account-tax-report-no-zeroes'
Itried all possible ways still getting thesame error
Find sum of all the elements of matrix using Java
how to find the sum of integers in a string of sentence in java
sum
how to print - Java Beginners
how to print spark dataframe data
how to print spark dataframe data
How to print UIButton id
how to print the following pattern
How to design a foot print on the sand, print on the sand, print
sum and average of grades
how to print pdf format
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