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
Jay H. Bosamiya: 2013-03-14 13:53:51

source limit is in no way stupid... since, otherwise, people may just hardcode the answers (since n is less than 100) as strings and then just output using if's

Sivaraman Nagarajan: 2013-02-20 12:00:23

Great ! Learnt a Technique ! Expecting problems like this

I think people shd stop using Java for this ;)

Last edit: 2013-02-20 12:04:44
raunakrocks: 2013-01-23 17:25:57

easy1!!not for java programmer :P :P

rajat pachouri: 2013-01-12 14:49:12

the code is running on my machine m getting the input and output as:
2
4
24
5
120


is anything still wrong..

Avinash Kumar: 2013-01-12 06:08:07

@NAVYA it may b the problem of inapropriate data type bcoz 99! is too large a no.

Himanshu: 2012-12-21 12:44:09

use basic intelligence to solve it.....................

strings: 2012-12-12 18:32:49

enjoyed doing it !! :)

Sidney Milien: 2012-12-08 07:08:32

@Navya, does your code work for the case when n = 100.?
I submitted my code earlier, neglecting this key criteria.

largest int using 64bit = 18,446,744,073,709,551,615

Last edit: 2012-12-08 14:04:07
Navya: 2012-12-03 17:39:09

my code is working fine on ideone bt here it is giving wrong ans...cn u tell y??

Zhongyuan.Lee: 2012-11-27 15:33:17

"small"? Indeed, we have to use array to store the number


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