
Factorial Calculation Problem
Given an integer N
, calculate and print the factorial of N
. The factorial of a number N
is defined as the product of all positive integers up to N
.
Example:
Input:
N = 4
Output:
24
Explanation:
The factorial of 4 is the product of 1 * 2 * 3 * 4 = 24.
Constraints:
1 ≤ T ≤ 10
1 ≤ N ≤ 100
- Time limit: 1 sec
Input:
The first line of input contains an integer,T
, the number of test cases.
For each test case, a single line contains an integerN
.
Output:
Print the factorial of N
for each test case on a separate line.

AnswerBot
4d

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

arbindkumarsingh
7mo
student at
Sikkim Manipal Institute of Technology, Gangtok

24
Anonymous
7mo

24
Anonymous
10mo

inTech Mahindra,Software Engineer Find Factorial of a Number. You are given an integer ‘N’. You have to print the value of Factorial of ‘N’. The Factorial of a number ‘N’ is defined as the product of ...read more
Add answer anonymously...
Top Tech Mahindra Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Top HR questions asked in Tech Mahindra Software Engineer
>
Tech Mahindra Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app