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

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

hide comments
2018-04-26 05:41:26
finally accepted!!!! Ac 0.02
2018-04-03 20:34:28
NOT RECOMMENDED
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!!!!!!!!!!!!!!
2018-03-28 17:26:38
is it ok if i display result after i accept numbers
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
2018-01-18 17:44:01
to all who are wondering why it's giving wrong answer on spoj while not on their systems,n is upto 100,but even long long int can score atmost 20!(it's too big),use strings with your own multiply function for strings
2017-12-26 13:03:53
on ideone all output is correct but on spoj it is showing wrong answer.why??
2017-12-12 22:02:38
Use string instead of numbers and make your own way to mulitiply strings
2017-12-08 02:30:05
in C you need to build a function that work with int* from 0 to 9 to represent the 100! (which have more than 158 decimal places)

Last edit: 2017-12-08 15:25:14
2017-11-26 22:15:03
how to reduce source code to 2000B in c?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.