From: M. M i c h a e l M u s a t o v on
on long factorial(int n) {0
result = 1;
while (n != 0) {
result = result * n;
n = n - 1;
}
return result;
}
From: Ostap S. B. M. Bender Jr. on
On Mar 3, 3:45 pm, "M. M i c h a e l M u s a t o v"
<marty.musa...(a)gmail.com> wrote:
> on long factorial(int n) {0
>    result = 1;
>    while (n != 0) {
>       result = result * n;
>       n = n - 1;
>    }
>    return result;
>
> }
>

This man is a genius!

From: scattered on
On Mar 3, 6:45 pm, "M. M i c h a e l M u s a t o v"
<marty.musa...(a)gmail.com> wrote:
> on long factorial(int n) {0
>    result = 1;
>    while (n != 0) {
>       result = result * n;
>       n = n - 1;
>    }
>    return result;
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -

cool: (-1)! = stack overflow
From: scattered on
On Mar 4, 11:57 am, scattered <sortofbutnotrea...(a)gmail.com> wrote:
> On Mar 3, 6:45 pm, "M.  M  i  c  h  a  e  l   M  u  s  a  t  o  v"
>
> <marty.musa...(a)gmail.com> wrote:
> > on long factorial(int n) {0
> >    result = 1;
> >    while (n != 0) {
> >       result = result * n;
> >       n = n - 1;
> >    }
> >    return result;
>
> > }- Hide quoted text -
>
> > - Show quoted text -
>
> cool: (-1)! = stack overflow

on second thought, (-1)! never halts but doesn't consume memory - so
it *is* simpler. On some implementations it might wrap around and get
to 0 eventually