Facorial Calculator

For the discussion of Perl, Python, Ruby, and PHP and other interpreted languages.

Re: Facorial Calculator

Post by acskurucz on Sun Mar 29, 2009 6:12 pm
([msg=20863]see Re: Facorial Calculator[/msg])

mutants_r_us_guild wrote:
acskurucz wrote:
Code: Select all
for($i=1; $i<=$n; ++$i) $factorial=bcmul($factorial, $i);

echo $factorial;

It can handle very very very big numbers. :)

I turned your code into a function:

function factorial($x){
for($i=1; $i<=$x; ++$i) $factorial=bcmul($factorial, $i);
return $factorial;

P.S. I incorporated that function into my bot :P

hehe, :D
New User
New User
Posts: 29
Joined: Wed Jan 14, 2009 8:31 am
Blog: View Blog (0)


Return to Interpreted Languages

Who is online

Users browsing this forum: No registered users and 0 guests