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

hide comments
Bishma: 2011-09-25 04:49:39

www.wolframalpha.com says 100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
and my output says that in my computer. Why am I getting wrong answer here?

Santiago Palacio: 2011-09-17 04:51:56

@kostis: long double wont do enough for 100!

Kostis Karantias: 2011-09-16 19:19:45

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
kousik: 2011-08-29 15:24:58

try checking it for larger values like 50, 60 and check if your code produces the exact result with precision upto 100+digits :)

sravanthi: 2011-08-29 11:36:49

i checked in ideone.com stillhere its showing wrong ans

Kuushagra Mittal: 2011-08-11 11:26:29

check your answer for 50 ,40,etc

defcon3 : 2011-08-07 16:07:06

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?

aashima: 2011-07-26 21:13:30

iam facing the same problem. al factorials are correct !still wrong ans?????

A.Ranjitha: 2011-07-25 18:47:03

wats NZECerror?????

Ryan OHara: 2011-07-14 21:33:53

I get a runtime error NZEC. But how do you return an exit code with JavaScript??!


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