Recursive function won't compile

ajaksu ajaksu at gmail.com
Wed Apr 2 16:57:12 EDT 2008


On Apr 2, 5:23 pm, bc1... at googlemail.com wrote:
> #include <stdio.h>
> #include <stdlib.h>
>
> def RecursiveFact(n):
>     if(n>1):
>         return n*RecursiveFact(n-1)
>     else:
>         return 1
>
> fact = RecursiveFact(31)
> print fact
The output is 8222838654177922817725562880000000 and is correct. But
the "#include"s tell me you're a bit confused. Have you tried running
"python yourscript.py" (where "yourscript.py" is the filename you
saved the above program to)?

HTH,
Daniel



More information about the Python-list mailing list