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
:D: 2010-12-10 18:45:49

I'm not sure I understood you correctly. If your program is printing anything but the decimal numbers as a sequence of digits, than this is WA.

You should always follow the format specified. Also exponential notation is probably rounding the numbers. How's that supposed to be judged?

I'm pretty sure you can get the desired result with bigint package in perl.

Kos: 2010-12-10 17:02:44

what's wrong with perl? i tested my solution with 100, 100, ..., and everything was ok. but here i get WA, is it because perl use exponential notation for big numbers?

Nebojsa: 2010-11-28 09:10:09

why is it that i have to resubmit my solution , and why does it say my programing language is ada then its C

Broteen Kundu: 2010-10-09 13:51:17

my compiler is giving no error, but when im submitting my solution, its coming compile time error! what should i do??

sashidhar: 2010-10-02 16:28:07

Last edit: 2010-10-03 06:02:09
coder: 2010-05-31 17:35:54

100! is 933262154439441526816992388562667004907159682643816214685929638952175999932
2991560894146397615651828625369792082722375825118521091686400000000000
0000000000000

158 characters long!!

Last edit: 2010-05-31 17:40:44
Seshadri R: 2010-05-17 05:55:47

@Subhajit Sadhu: The data type (int, unsigned or long long unsigned) used by you for holding the result could have been too small and an arithmetic overflow would have resulted

Subhajit Sadhu: 2010-05-06 14:58:49

my own compiler is giving correct result..bt when I'm submitting in ur compiler it is giving "runtime error (SIGABRT)" wht does this imply ???

Jason Robinson: 2009-12-31 17:03:49

It seems that bignum is disabled for Perl. How can we provide the desired answer without it?


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