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

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

hide comments
2020-03-08 18:40:31
alhamdulillah AC first submit in C
2020-02-23 00:26:26
why does python work excellently for this problem but C++ just can't? Is there a tweak to expanding the limit of numbers beyond long long int?
2019-12-02 19:20:23
Why isn't recursion working for large numbers?
2019-09-29 15:00:26
yea use an array for storing large numbers , : ) to overcome overflow
2019-07-26 12:13:58
array method

Last edit: 2019-07-26 14:18:51
2019-07-17 19:23:01
Initially assumed that we must use java or other languages to calculate factorial of 100
this is my 1st ever program accepted in C
learnt a new technique thank you
2019-07-09 19:41:38
why my code using dp is given WA?
2019-06-26 10:15:51
i got the Test cases correct but got a wrong answer...
2019-06-15 05:41:56
any other solution than the biginteger?

Last edit: 2019-06-15 05:46:49
2019-06-10 02:33:55
tusharupadhyay
it is correct for small positive numbers
but for large numbers such as 100,99,98 it is giving wrong result as range of int excedded
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.