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

Sample input:
4
1
2
5
3

Sample output:

1
2
120
6

hide comments
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??!

Ying Sihao: 2011-07-09 07:11:03

You should use ExtEnded.
I hope you can succeed.

luca tavernari: 2011-07-05 14:41:11

i'm using a long double but it seams not to be enough, what should i do ?


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