Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com

Factorial Of Large Number

Moderate
0/80
Average time to solve is 30m
profile
Contributed by
70 upvotes
Asked in companies
AdobeMakeMyTripMicrosoft

Problem statement

Given an integer ‘N’, you are supposed to return the factorial of the given integer in the form of a string.

Detailed explanation ( Input/output format, Notes, Images )

Input format :

The first line contains a single integer ‘T’ denoting the number of test cases.

Each test case contains a single line with a single integer ‘N’ denoting the given number.

Output format :

For each test case, print a string denoting the factorial of the given number in a separate line.

Note :

You do not need to print anything; it has already been taken care of. Just implement the given function.

Constraints:

1 <= T <= 50
1 <= N <= 500

Time Limit: 1 sec.
Sample Input 1:
2
3
4
Sample Output 1:
6
24
Explanation to Sample Input 1:
In the first test case, the factorial of 3 is 1x2x3 = 6.

In the second test case, the factorial of 4 is 1x2x3x4 = 24. 
Sample Input 2:
2
5
1
Sample Output 2:
120
1
Full screen
Console