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
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

arbindkumarsingh
11mo
student at
XIBmS
24
Anonymous
11mo
24
Anonymous
1y
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...
Tech Mahindra Software Engineer interview questions & answers
A Software Engineer was asked 1w agoQ. How do you train a machine?
A Software Engineer was asked 2mo agoQ. What is Kotlin?
A Software Engineer was asked 2mo agoQ. Tell me about your projects and training.
Popular interview questions of Software Engineer
A Software Engineer was asked 1w agoQ1. How do you train a machine?
A Software Engineer was asked 2w agoQ2. What are the key concepts of Object-Oriented Programming, and why are they used?
A Software Engineer was asked 2w agoQ3. What is the difference between String and StringBuilder, and in what circumstanc...read more
Top HR questions asked in Tech Mahindra Software Engineer
A Software Engineer was asked 4mo agoQ1. What is your salary expectation?
A Software Engineer was asked 5mo agoQ2. Are you willing to relocate?
A Software Engineer was asked 5mo agoQ3. Can you tell me about yourself?
>
Tech Mahindra Software Engineer Interview Questions
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

