diff --git a/src/exponent.c b/src/exponent.c index 3f4895a..e82de4e 100644 --- a/src/exponent.c +++ b/src/exponent.c @@ -1,4 +1,5 @@ #include +#include #include "exponent.h" @@ -24,4 +25,17 @@ double expIN(double e, double num){ } } return 0; -} \ No newline at end of file +} + +unsigned long long fac(int x){ + unsigned long long prod = 1; + if(x==0) return 1; + for (int i = 1; i <= x; i++){ + if (prod > ULLONG_MAX / i){ + break; + } + prod*=i; + } + return prod; +} +