The assignment was to create a program to estimate the factorial of a positive integer using Gosper's formula. I changed it to display intermediate values to find the error, and it looks like root_part is only using the "2n" and not the full "2n + 1/3", but I can't figure out why it's doing that. Reversing them had no effect either. The rest seems accurate given the wrong root_part value.

Any help would be greatly appreciated.

Code:#include <stdio.h> #include <math.h> #define PI 3.14159265 int main(void) { double n, root_part, root_solved, n_factorial; printf("Enter a positive integer> "); scanf("%lf", &n); root_partial = (1 / 3) + (2 * n); printf("Variable root_part = %f \n", root_part); root_solved = sqrt(root_part * PI); printf("Variable root_solved = %f \n", root_solved); n_factorial = (pow(n,n) * exp(-n)) * root_solved; printf("%.0f! equals approximately %.5f \n", n, n_factorial); return(0); }