Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Thread Tools Display Modes
Posts: n/a
Default factorial - 10-26-2009, 01:29 PM

Please I've tried 1000 times could not do the factorial func.

I can do by loops if the number was 6
the object will 6 5 4 3 2 1 but he does not calculate it
Reply With Quote
Super Moderator
x2495iiii's Avatar
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 11-22-2009, 04:12 AM

Apologies for not seeing this question earlier.

I don't think there is a factorial function in Alice, so unfortunately you'll have to do it the hard way and have two number variables, one the total variable (starts as the original number) and one the counter variable inside a loop, in a method which sets the value of the total variable to the product of the total variable and the counter variable (which is the original number - 1), then decrements the counter variable by one.


Last edited by x2495iiii; 11-22-2009 at 04:32 AM.
Reply With Quote
Senior Member
jediaction's Avatar
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 11-24-2009, 01:47 PM

I agree, i dont think there is

Reply With Quote
Senior Member
reuben2011's Avatar
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 11-25-2009, 07:34 PM

I don't think there is one either. I remember coding a script in PHP that would calculate factorials though. It wasn't that hard.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright ©2022, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.