📅  最后修改于: 2022-03-11 14:44:50.451000             🧑  作者: Mango
#include
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