FCTRL2 - Small factorials

You are asked to calculate factorials of some small positive integers.

Input

An integer t, 1 ≤ t ≤ 100, denoting the number of testcases, followed by t lines, each containing a single integer n, 1 ≤ n ≤ 100.

Output

For each integer n given at input, display a line with the value of n!

Example

Input:
4
1
2
5
3

Output:
1
2
120
6

Added by:adrian
Date:2004-05-28
Time limit:1s
Source limit:2000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

hide comments
2011-09-25 04:49:39 Bishma
www.wolframalpha.com says 100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
and my output says that in my computer. Why am I getting wrong answer here?
2011-09-17 04:51:56 Santiago Palacio
@kostis: long double wont do enough for 100!
2011-09-16 19:19:45 Kostis Karantias
I use long double and I output it with "%.0Lf".

For 100! I get:
93326215443944152668565874012822813729098311759684
57842257147719122795848879719683777606888162568261
38387766738917471856517769978700228574656024367967
80642304

What are these trailing zeroes you guys have?

Last edit: 2011-09-16 19:20:09
2011-08-29 15:24:58 kousik
try checking it for larger values like 50, 60 and check if your code produces the exact result with precision upto 100+digits :)
2011-08-29 11:36:49 sravanthi
i checked in ideone.com stillhere its showing wrong ans
2011-08-11 11:26:29 Kuushagra Mittal
check your answer for 50 ,40,etc
2011-08-07 16:07:06 defcon3
Can someone please clarify something for me - Are the inputs all entered at the same time? if it is, how can I allocate memory for the inputs if I dont know how many there will be before runtime?
2011-07-26 21:13:30 aashima
iam facing the same problem. al factorials are correct !still wrong ans?????
2011-07-25 18:47:03 A.Ranjitha
wats NZECerror?????
2011-07-14 21:33:53 Ryan OHara
I get a runtime error NZEC. But how do you return an exit code with JavaScript??!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.