Solution for "c++ program to find the factorial of a number"

#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

c++ factorial

Similar codes for "c++ program to find the factorial of a number"


Latest 'C++' questions

Added before "c++ program to find the factorial of a number"