Answers for "c++ program to find factorial"

C++
8

c++ factorial

#include <cmath>

int fact(int n){
    return std::tgamma(n + 1);  
}    
// for n = 5 -> 5 * 4 * 3 * 2 = 120 
//tgamma performas factorial with n - 1 -> hence we use n + 1
Posted by: Guest on July-09-2020

Code answers related to "c++ program to find factorial"

Browse Popular Code Answers by Language