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
ubc_123: 2019-09-29 15:00:26

yea use an array for storing large numbers , : ) to overcome overflow

dhia01: 2019-07-26 12:13:58

array method

Last edit: 2019-07-26 14:18:51
mahesh_1997: 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

pretam9: 2019-07-09 19:41:38

why my code using dp is given WA?

h_7: 2019-06-26 10:15:51

i got the Test cases correct but got a wrong answer...

vurise18: 2019-06-15 05:41:56

any other solution than the biginteger?

Last edit: 2019-06-15 05:46:49
tk_000: 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

pyskmr: 2019-05-30 19:39:57

python is a shit language,
i did it via python with no logic at all

Last edit: 2019-05-30 19:40:06
thunderboltz_: 2019-05-30 10:52:13

printf("% ",factorial); //factorial belongs to double
Anyone do tell me. What should be written? in this blank space to remove that trailing zeros (0s) after decimal point

thunderboltz_: 2019-05-30 10:48:02

we shuold use "double" data type to get 100! and most importantly output doesn't have trailing zeros (0s) .


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