Sphere Online Judge

SPOJ Problem Set (classical)

24. Small factorials

Problem code: FCTRL2

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 Kosowski
Date:2004-05-28
Time limit:1s
Source limit:2000B
Languages:All except: TECS

hide comments
2010-01-19 12:35:38 Abhishek bhardwaj
how can i increase precetion of float values in C
2009-12-31 18:03:49 Jason Robinson
It seems that bignum is disabled for Perl. How can we provide the desired answer without it?
2009-09-21 07:40:31 小岛
Evaluating the scale of the result sometimes is important..especially for this one..
2009-09-05 15:48:30 Krzysztof Kosiński
biswajyoti das: it means you defined main() with a return type other than int and/or you are missing a 'return 0' at the end.
2009-08-31 15:07:43 dreivaj (Slash at the moment)
The problem is BigInteger
2009-08-23 11:28:51 Chris
Ruby 0.03s, if your program is too slow i suggest to take look into caching

Last edit: 2009-08-23 11:31:37
2009-08-20 22:04:53 Robert Mochang Otome
I have written a correct program but it's more than 4k bytes. Can you do something about allowable source size?
2009-07-13 09:09:29 Ilya
Don't use recursion in C++! Use cycle!
2009-07-05 11:48:21 Emad William
use big numbers (i.e. store in a string)
2009-07-02 00:26:21 Nathan Smith
1 line in Ruby
SPOJ System © 2008-2010 Sphere Research Labs. All Rights Reserved.