Factorial of a Number Problem Statement
You are provided with an integer 'N'. Your task is to calculate and print the factorial of 'N'. The factorial of a number 'N', denoted as N!, is the product of all positive integers from 1 to 'N'.
Example:
Input:
N = 4
Output:
24
Explanation:
The factorial of 4 is computed as 1 * 2 * 3 * 4, resulting in 24.
Constraints:
- 1 <= T <= 10
- 1 <= N <= 100
- Time limit: 1 second
Input:
The first line contains an integer 'T', the number of test cases.
Each test case is represented by a single integer 'N'.
Output:
For each test case, print the factorial of 'N' on a new line.

AnswerBot
4mo
Calculate and print the factorial of a given integer 'N'.
Iterate from 1 to N and multiply each number to calculate factorial
Handle edge cases like N=0 or N=1 separately
Use recursion to calculate facto...read more
Help your peers!
Add answer anonymously...
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

