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
lamda_cdm_10: 2020-12-22 15:08:25

Use the vectors in reverse order

aaronphilip_03: 2020-12-05 22:02:35

I just finished this program using arrays in a reverse order in C++. For those of you you'll doing it with the traditional method of calculating a factorial, your answer is not wrong but, while the solution is being checked you will get an error because it is trying to calculate a factorial of a very large number between 1 and 100.

satyam_656: 2020-11-25 16:12:27

DO with c++ and use array in reverse order to store the answer.

samiya_ahmed5: 2020-11-06 13:32:13

it can be solved using cpp .. the key idea is to keep the answer in an array ....

thanos_tapras: 2020-09-05 17:22:18

I don't think c++ is ideal here. Python (or bigInt with Java) is the way to go.

Last edit: 2020-09-05 17:22:37
akhilesh_2109: 2020-08-25 07:02:30

Go with python ..ac one go!

entente888: 2020-07-22 18:18:26

its name is the biggest troll lol
small factorial but very big answer

amanrathod007: 2020-06-29 09:34:19

For c++ users :if you want to learn good concept then avoid boost library.
Think if you can use string for big numbers

hello_1234: 2020-06-04 17:43:53

My answer is totally correct ans it's saying wrong answer.WHy!!!!!!!!!!!!

cre_jug_07: 2020-06-01 20:26:24

define a function and map every input to it in Python!


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