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
2018-08-02 21:35:09
Use Java's BigInteger for calculation involving large number digits.
2018-07-26 09:00:23
Can anyone please help me what mistake am I making ?
This is happening with me for almost all the solutions that I submit.
Link :<snip>

Last edit: 2022-09-17 23:08:17
2018-06-29 15:27:24
in c++ , use boost library, and dont forget to choose c++14(gcc6.3) compiler otherwise you will get compiler error
2018-06-16 19:14:06
You can use this algorithm here to solve the problem.
https://www.geeksforgeeks.org/factorial-large-number/
2018-06-13 05:28:57
big numbers=boost library
2018-06-11 11:17:35

C/use concept of multiplication of numbers in array
2018-06-05 02:59:11
If you wanna use dp, don't try it with C++. Use Python, the variable limits are bigger ;)
2018-06-02 15:06:41
AC in one go!!.. :)

Last edit: 2018-06-02 15:07:53
2018-05-20 12:10:17
guys always check for the compiler type like if anyone here uses C then i will tell u C has many compiler types like borland , gcc etc.so i use the gcc and runtime error can only be created because u are using a different compiler .
2018-05-15 23:58:11
its easy if using gmp.h library in C
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.