factorial

Solutions on MaxInterview for factorial by the best coders in the world

showing results for - "factorial"
Sebestian
01 Jan 2018
1function BracketCombinations(num) { 
2  return (1 / (num + 1)) * choose(2 * num, num);
3}
4
5function fact(num) {
6  let sum = 1;
7  for (let i = 1; i <= num; i++) {
8    sum *= i;
9  }
10  return sum;
11}
12
13function choose(num, k) {
14  return fact(num) / 2 * (fact(k) * 1 / fact(num - k));
15}
Mattia
29 Jan 2017
1unsigned long long factorial(unsigned long long num){
2
3    if(num<=0)
4        return 1;
5
6    return num * factorial(num-1);
7}
Hannah
27 Oct 2016
1// FACTORIAL 
2// 5! = 5 * 4 *3 * 2 *1 = 120 
3
4const number = 5;
5let fact =1 ;
6
7for(let i=number;i>=1;i--)
8{
9  console.log(i)
10  fact = fact * i;
11}
12console.log("FACTORIAL is :: ",fact);
Burton
12 Jul 2020
1//Java program to find factorial of a numberimport java.util.Scanner;public class factorial{		public static void main(String[] args)	{		//scanner class declaration		Scanner sc = new Scanner(System.in);		//input from user		System.out.print("Enter a number : ");						int number = sc.nextInt();		if(number >= 0)		{			//declare a variable to store factorial			int fac = 1;			for(int i = number ; i >= 1 ; i--)			fac = fac * i;			//display the result			System.out.println("Factorial of "+number+" is "+fac);			//closing scanner class(not compulsory, but good practice)		}		else			System.out.println("Value is not defined, please re-enter the value");		sc.close();														}}
Roberto
10 Jan 2021
1#include<stdio.h>
2#include<conio.h>
3void main()
4{
5   int fact, i, n;
6   fact = 1;
7   printf("Enter the number\t");
8   scanf("%d" , &n);
9   for(i = 1; i <= n; i++)
10   {
11       fact = fact*i;
12   }
13   printf("Factorial of %d is %d", n , fact);
14   getch();
15}
Anna
03 Jan 2021
1public static void  factorial(int num){
2
3    if(num<=0)
4        return 1;
5
6    return num * factorial(num-1);
7}
Neele
08 Mar 2018
1// METHOD ONE
2const factorialNumber = num => {
3    let factorials = []
4    for(let i = 1; i <= num; i++) factorials.push(i)
5    return factorials.reduce((acc , curr) => acc * curr, 1)
6}
7
8// METHOD TWO
9const factorialNumber = num => {
10    let factorial = 1, i = 1
11    while(i <= num){ factorial *= i; i++ }
12    return factorial
13}
14// METHOD THREE
15function factorialNumber(num) {
16    if(num < 1) return 1
17    else return factorialNumber(num - 1) * num
18}
queries leading to this page
compute factorialwhat is the factorial of 3what i s a factorialwhat 27s the factorial of a numberwhat is 6 factorialfactorial symbolfactor this numberfactorial numbers5 factorial numbersfactorial series symbolfactorial listformulat for factorialwhat s a factorialformula to find factorial of a numberfactorial of a number onlinefactorial propertiesfactorial 2a 3di calculate the factorial of a numberfactor numbersformula for n 21what is 1000 factorial33 factoriala factorialwhat is the factorial of 0what is the factorial of 8factorial of a number factorial of a number ifactorial of a number nfactorial of a number5 factorialfactorial 15number factorial4 factorialnumber and their factorialfactorial 5cf 28n 29 3dn 21 28f 28n 29is n factorial 29factorial mathshow is zero factorial equal to 1factorial 4factorial of 10what is a factorialformula for factoria 3bfactorial of a num6 factorial is factorial explainedfactorial sequencefactorial signfactorial 27factorial ofgive the factorial of 1 to n 3ffactorial 0f 10bracket combinationsfactorial function matchsnumber is factorial of a numberfactoring rulesfactorial in mathsfunction factorialwhat is factorial of 2number is factorialwhat is a factorial numberchoose a number to factorialwhat are factorial numbersfactorial n formulawhats the factorial numberfactoral of zerowhat is factorial mathfactorial of a numbenumbers of factorialfactorial 2a 3d iwhat is factorial numberfactorial of anumberfactorial numberwhat is a factorial in math171 factorialcode factorfactorial of a number meanshow to use factorial function inclist factorial of first 10 numbersvalue of 10 factorialfactorial of 52 factorialfactorial native function languagefactorial 1what is the factorialfactorial function5 21 factorialfactorial rulesmath factorialwhat 27s a factorialfactorial number meansfactorial numbers listhow to calculate factorial of a numberwhats the factorial of 4n factorialfactorial 8factorial n10 factoriallist of factorialswhat is the factorial of 218factoring numbersfactorial 10 resultfactoringwhat is 7 factorial factorial2 factorial valuefactorial formulaswhat is factorial of a number1 factorialfactorial of 14factorial of nfactorial what isfactorial arithmeticone factorialfactorial of factorialfactorial of number120 2f 286 2a2 29whats a factorialfactorial for 2culawhat are factorialfactorial of numbfactorial 21 factorial 5factorial 285 29what is 0 factorialfactorial meansfactorial of 28n 29is factorialfactorial 3factorial of 2factorial sign in mathsfactorial mathfactoral numberswhat is the factorial of a numberwhat is the factorial of 5factorial examplesfactorial of 3 isthe factorial of a numberwhat is factorialfactorization of 345factorial calculation rules8 factorialfactorial number definitionmath factorialformula for factorialfactorial isfactorial of the numberwhat is factorial meanfactorial 2definition of factorial number the factorial of a number 286 factorial 2a 6 factorial 29 2f 3factorial formula in mathematics6 factorialfactorial 7factorial of 4factorial of number from factorial of 7what does factorial do7 factorialvalue of the number e2 80 99s factorialfactorial 3f 2f5 factorial ishow much is 1904711 factorialfactorial in mathfactorial formupahow 0 factorial is 1what is factorial designwhats the factorial of a numbercalculate the factorial of number14 factorialfactorial of 4 iswhat is factorial of threehow to calculate factorialfactorial of 8what factorial numberdefine factorial15 factorialfactor analysiswhat is the result of 4 21 28four factorial 29factorial of 3factorial how to find factorialfactorial 9factprial formulamaths factorialwhat is factorial of numberwhat is 10 factorialn 21 formulasimple factorization questionsfactoring a numberfactorial 28factorial meaning12 factorialn n factorialfactorial of 1factorial of a numbershow do you get the factorial of a numerfactorial of 13factorial factorial 1 factorial of numberfactorial equationfactorial using math formulawhat is a factorial of a numberbracket combinations problemwhat is 5 factorialn factorial formulafactorial formulanumpy factorialwhat is six factorialwhat is factorial in mathfactorial 10factorial of a given numbers 9 factorialfactorial operatorfactorial 282 2a3 29 21factor thismeaning of factorial numberfactorial definition8 factorial valuecalculate factorialwhat aare factorial numbers3 factorialfactorial formula in mathsfactorial of numbersfactorial of 6what is factorial in mathsfactorial examplewhat does factorial mean 3ffactorial