Submit | All submissions | Best solutions | Back to list |
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
Input: 4 1 2 5 3 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
|
||||||||||||||
2015-03-05 18:29:48 Tista Saha
my program is running well in gcc and is showing segmentation fault here.can anyone help? |
||||||||||||||
2015-02-20 20:32:09 Rishabh Prasad
Hello everyone.. All coders who are facing problems to store such a large numbers i want to give a hint.. Use arrays to store number... |
||||||||||||||
2015-02-07 02:23:15 l4mbda
as said before a recursive function tackles this easily |
||||||||||||||
2015-01-21 19:02:25 subhash kumar
how to find currect solution of problem |
||||||||||||||
2015-01-07 13:09:48 Michael Scofield
PYTHON simply Rocksss... |
||||||||||||||
2015-01-01 18:47:07 Adesh Atole
Use java.math.BigInteger |
||||||||||||||
2014-12-12 16:06:55 Tanvi Singh
What data type to use to store factorial of numbers like 100! ? |
||||||||||||||
2014-12-02 17:16:47 Swapnil Borse
Hello everyone, saw in the comments that many are struggling with the wrong answers.The maximum number that we can store in an unsigned 32 bit integer is 2 ^ 32 - 1 and in an unsigned 64 bit integer is 2 ^ 64 - 1. Something like 100!('!' is the notation for factorial) has over 150 decimal digits. The data types mentioned earlier can store numbers having at most 9 and 19 decimal digits respectively. So make sure that you take a note of this and then try to decide your approach. Nice problem to trick the coders ;) |
||||||||||||||
2014-12-01 08:26:55 Asha Menezes
how to submit an answer for this question? --ans(Francky)--> Please try TEST first. You'll find a submit link for your code ; a solution is provided too for this lonely problem in forum. Last edit: 2014-12-01 15:34:48 |
||||||||||||||
2014-11-29 09:09:25 Himgiri Garg
My code prints out correctly for every number between 1 and 100. Not sure what the error could be. |