Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: differnt methods to sum positive numbers to achieve a number
Date: Fri, 12 Dec 2008 15:45:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 13
Message-ID: <ghu0u1$8q9$1@fred.mathworks.com>
References: <ghtu23$ikh$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229096705 9033 172.30.248.35 (12 Dec 2008 15:45:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 12 Dec 2008 15:45:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870065
Xref: news.mathworks.com comp.soft-sys.matlab:506591


"Amir Hossein " <a.gharehgozli@gmail.com> wrote in message <ghtu23$ikh$1@fred.mathworks.com>...
> 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

What about 0.1, 0.001, pi, 4.99999999999 etc. These are also positive numbers! Or do you mean integers only?

I suggest you get some inspiration for writing your own code by looking at some of the excellent submissions by JohnD'Errico on the File Exchange.

hth
Jos