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
abhitwenty22: 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 .

charlles: 2018-05-15 23:58:11

its easy if using gmp.h library in C

anushka_ahuja: 2018-05-12 21:35:18

i m using array and made my own function to multiply them and it is giving 100! on codeblocks but WA here what should i do?

awadhesh_123: 2018-05-12 07:09:15

I am using double and I get 162 decimal place for 100! but still, I am getting the wrong answer.

thunderbird18: 2018-04-26 05:41:26

finally accepted!!!! Ac 0.02

siva2697: 2018-04-03 20:34:28

NOT RECOMMENDED

frustrated: 2018-03-30 16:01:43

What is the problem with java compiler of SPOJ??? Everytime it is giving Runtime error, where I can easily run it in my IDE,without any exception or error!!!!!!!!!!!!!!

c_siddhesh11: 2018-03-28 17:26:38

is it ok if i display result after i accept numbers

atlanta_bear: 2018-03-09 15:58:48

getting SIGSEGV with C++, any ones faced this before??
Edit: Got it, the array was going overbound( Thanks to http://www.spoj.com/tutorials/USERS/#seg). Just increased the array size to accommodate a bigger number of digits.

Last edit: 2018-03-09 16:04:38
kazakata: 2018-02-11 08:40:20

Last edit: 2018-02-11 08:40:54

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