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
B.R.ARVIND: 2012-03-31 06:57:08

use char array in case of c and string in case of c++.. in java ,can use BigInteger

chandanapericharla: 2012-03-29 16:08:24

On checking I found that it works good only till 22!(c lang) from 23!(used double to store the factorial) the zeros are being omitted. I could not make out a what the problem is. Can any one please help me out. Thank you in advance.

Last edit: 2012-03-29 16:10:59
Vikas Yadav: 2012-02-29 16:41:20

what name to give to file in java????

Dario Pavlovic: 2012-02-23 01:23:12

im really not sure why im getting a wrong answer here, i checked almost all possible solutions with wolfram alpha and still getting wa.

Last edit: 2012-02-23 01:24:30
Mukund Kumar: 2011-12-30 12:46:08

i m getting ri8 answr on turbo compiler....hwevr gettin ce on it.....plz help

Santiago Zubieta: 2011-12-06 22:54:37

Use BigInteger in Java..

jayanth kumar: 2011-11-08 05:54:10

how to store values from 40! to 100!
i am not getting the correct output.

Dominik: 2011-10-04 21:12:22

I sent 10 times, tested more than 10 numbers like 0,1,2,3,4,5,10,20,30,50,60,70,80,90,100... All are correct and I'm printing cout << endl; after each (I also tried with printf("\n");... And whole time I'm getting wrong answer T_T, is there some kind of bug?? (programiming in C++) Thx for any reply

jayesh hathila: 2011-10-02 06:51:27

i ran a for loop and printed all the test cases from 1 t0 100 but here its giving "nzec".plz help me

Hitman: 2011-09-25 05:32:55

I got runtime error NZEC, while uploading my code in python. why??


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