Click here to Skip to main content
15,886,816 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
if array={1,2,3,4}
sub arrays
{1,2} {1,3} {1,4} {2,3} {3,4} {1,2,3} {2,3,4}...and thier respective sums
give any idea.
Posted
Updated 16-Dec-14 3:46am
v2

1 solution

What you are looking for is called "Combinations" - and there is a lot about them out there, some of which may be useful to you. Google can help a lot here in working out the algorithm.

But...it's your homework, and it's important that you do it yourself: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But it is very important that you try for yourself.
 
Share this answer
 
Comments
moyna coder 16-Dec-14 10:51am    
yeah me trying. thank you for your consult
OriginalGriff 16-Dec-14 11:03am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900