Ads

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

Ads

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: