Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe06.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Organization: Canada Eat The Cookie Foundation
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: differnt methods to sum positive numbers to achieve a number
References: <ghtu23$ikh$1@fred.mathworks.com>
In-Reply-To: <ghtu23$ikh$1@fred.mathworks.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 14
Message-ID: <jLv0l.4$fv3.2@newsfe06.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe06.iad 1229097039 24.79.146.116 (Fri, 12 Dec 2008 15:50:39 UTC)
NNTP-Posting-Date: Fri, 12 Dec 2008 15:50:39 UTC
Date: Fri, 12 Dec 2008 09:50:48 -0600
Xref: news.mathworks.com comp.soft-sys.matlab:506596


Amir Hossein wrote:
> consider that we have a number. for example 5. i want to know how i can writhe
> a code to mention all the different ways that positive numbers can be summed up to give 5.
> 1+1+1+1+1
> 2+3
> 2+2+1

Consider using recursion.

-- 
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?