The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,
5! = 5 * 4 * 3 * 2 * 1
The value of 0! is 1, according to the convention for an empty product.
The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis.
Usually a program in C to find factorial would have the logic as
int n,i=5; while(i>0) { n=n*i; i--; }
Problem that lies here is C language cannot handle large numerical data values in a single integer.
Task To find factorial of any number till 1000 in C.
Input Format t (1 <= t <= 10) test cases will be given with each case having number n ( 0 <= n <= 1000 ) whose factorial is to be found.
Output Format Factorial of n and each test case t in new line.
Sample Input 2 10 8
Sample Output 3628800 40320