Answers for "what is a factorial"

C++
14

calculate factorial

int factorial(int n) {
	int res = 1, i; 
    for (i = 2; i <= n; i++) 
        res *= i; 
    return res; 
}
Posted by: Guest on May-02-2020
2

factorial

unsigned long long factorial(unsigned long long num){

    if(num<=0)
        return 1;

    return num * factorial(num-1);
}
Posted by: Guest on December-28-2020

Code answers related to "what is a factorial"

Browse Popular Code Answers by Language