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

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

hide comments
2022-01-14 19:12:16
solved in c, used library strrev function but CE was shown, so implemented it in the source code and got AC .
2022-01-09 15:15:03
Can I use boost multiprecision ??
2021-12-14 06:22:11
Be careful!!! Use line break at end of each testcase..
2021-10-22 07:56:16
For those using Java, use BigInteger Class!!
2021-10-10 05:08:39
Actually 100! cant be stored in long long also, so use different approach
2021-09-27 14:33:47
Use python for ac. I've used C++ with traditional recursion function but got wrong answer all time. So I've used Python with factorial recursion and got ac with ease. Happy Coding.

Last edit: 2021-09-27 14:34:16
2021-03-21 22:50:09
Used fortran and array -- integer(8), dimension(1000) :: Array
2021-01-18 21:12:41
Using vector to store the answer makes it easier to solve in C++. Using Java BigInteger or using Python will not help in learning.
2021-01-03 08:33:30
its showing your solution is too long
2020-12-27 18:24:06
Used arrays in reverse order got AC after many attempts :((
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.