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
frankitox: 2015-08-04 05:23:09

This problem It's only interesting only for languages that don't automatically handle big numbers. I tried to do it in C, but didn't work out how to print the number. Then I change to Ruby, and it take only a couple of lines.

whatisyourname: 2015-07-29 10:08:16

For WA people: the tester checks for 0! even though this shouldn't happen by the problem statement, and only accepts the WRONG answer 0!=0.

karthik1997: 2015-07-22 19:43:49

just use string and :D 0.00s no algo nothing used

chin: 2015-07-03 12:52:48

My 50th!!...:D

BadeMeow: 2015-07-01 13:58:28

Please check my submissions don't know why I am getting a WA.
All the values are correct even compared the O/P file with an accepted solution's O/P file.
Help please!

Vars: 2015-06-23 19:44:58

easy after learning java..

tongfeifan: 2015-06-08 22:15:54

This problem will be extremely easy, if u code in python.

ruimgf: 2015-05-29 19:03:59

Can i use gmp lib from c language?
Which libs can i use?

yoprati: 2015-05-28 21:15:05

Every other code runs perfectly on ideone but it isn't accepted here. Used a double. Help !

shubhi: 2015-05-17 17:32:29

use this algorithm.
http://www.geeksforgeeks.org/factorial-large-number/


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