by Arrexel on Mon Feb 16, 2009 11:03 am
([msg=18020]see Facorial Calculator[/msg])
As stated in my previous post, I have been bored lately, writing occasionally useful code. This time I have written a very simple collection of lines that calculates the factorial of a number. This code is useful for calculating the total number of possibilities that a word list generator can produce.
- Code: Select all
a = long(raw_input("Number: "))
b = a
factorial = a
while a > 1:
a -= 1
factorial = factorial * a
print "The factorial of",b,"is:",factorial
Factorial:
Mathematics. the product of a given positive integer multiplied by all lesser positive integers: The quantity four factorial (4!) = 4 · 3 · 2 · 1 = 24.
Symbol: n!, where n is the given integer.
-Reference.com
Last edited by
Arrexel on Mon Feb 16, 2009 7:07 pm, edited 2 times in total.
"I think there is a world market for maybe five computers."
Unverified Quote, 1945 - Thomas J. Watson, Founder of IBM