View Full Version : factorial
mkatib
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
x2495iiii
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.
jediaction
11-24-2009, 01:47 PM
I agree, i dont think there is
reuben2011
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.