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 all numbers from 1 to ‘N’.
For Example:
Consider if ‘N’ = 4, the Factorial of 4 will be the product of all numbers from 1 to 4, which is 1 * 2 * 3 * 4 = 24. Hence, the answer is 24.
Input Format:
The first line of the input contains an integer, 'T,’ denoting the number of test cases.
The first and only line of each test case contains one single integer ‘N’ representing the given integer.
Output Format:
For each test case, print the value of factorial of ‘N’.
Print the output of each test case in a separate line.
Constraints:
1 <= T <= 10
1 <= N <= 100
Time limit: 1 sec
CodingNinjas
author
2y
Using Linked List
In this approach, we will calculate the factorial of the given number and store it in the form of a Linked List of digits named digits. To do this, we will define a function multiply...read more
CodingNinjas
author
2y
Using An Array
In this approach, we will calculate the factorial of the given number and store it in the form of an array of digits named digits. To do this, we will define a function multiply(digits, ...read more
Help your peers!
Add answer anonymously...
Top Park Plus Full Stack Developer interview questions & answers
Popular interview questions of Full Stack Developer
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