You are viewing a single comment's thread. Return to all comments →
This is hilariously trivial in Ruby, which automatically creates big integers (Bignum) as needed. I should probably try it in a language that doesn't one of these days.
I know. Try it in c, c++
Python as well. Sum = n = input. while n > 1, decrement n and sum *= n, print sum, 5 lines.
I think you're right, this is almost cheating in these languages.
from math import factorial
Can u please explain Hoe to do this...
ausgabe = n
for q in range(1, n):
ausgabe *= (n - q)
Thanks a Lot.......I got cleared.
print reduce(lambda x,y: x*y,xrange(2,long(raw_input().strip())+1))
Another reason why I love (and sometimes hate) so much Ruby =]
Yeah, I did that in Python first, wrote two lines of code. Felt like cheating, haha.