| delorie.com/archives/browse.cgi | search |
| Date: | Mon, 8 Feb 1999 00:15:59 -0500 (EST) |
| From: | Daniel Reed <djr AT narnia DOT n DOT ml DOT org> |
| To: | Luis Pistoia <lu5gpl AT arnet DOT com DOT ar> |
| cc: | djgpp AT delorie DOT com |
| Subject: | Re: recursive factorial |
| In-Reply-To: | <002301be5318$9d1b86e0$461b2bc8@luis> |
| Message-ID: | <Pine.LNX.4.10.9902080014460.11546-100000@narnia.n.ml.org> |
| MIME-Version: | 1.0 |
| Reply-To: | djgpp AT delorie DOT com |
On Mon, 8 Feb 1999, Luis Pistoia wrote:
) else{
) printf("%d * ",passed);
) return passed * rcs_factorial(--passed);
) }
Try just
return(passed * rcs_factorial(passed - 1));
instead. --passed decreases the actual passed variable, which is not what
you want to do.
--
Daniel Reed <n AT ml DOT org>
As I said before, I never repeat myself...
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |