I need a function dedicated for the square root part of my problem. How do I split it up properly?Code:// Required Libraries #include <stdio.h> #include <stdlib.h> #include <math.h> // Program Defined Specifics #define PROGRAMMER_NAME "Leigh McKenzie" #define PI 3.14159 #define E 2.7182818284; // Start Program int main(void) { double n; // User defines this variable double sqrt_partial; // Gosper's formula under the square root, leaves out PI double sqrt_solved; // sqrt_part square rooted double n_factorial; // powers multipled by the solved square root printf("ESTIMATE A FACTORIAL NUMBER\n"); printf("This program was written by %s.\n", PROGRAMMER_NAME); printf("Please enter a positive integer: "); scanf("%lf", &n); sqrt_partial = (2.0 * n) + (1.0 + 3.0); sqrt_solved = sqrt(sqrt_partial * PI); n_factorial = pow(n,n) * exp * sqrt_solved; printf("%.0f! equals approximately %.5f \n", n, n_factorial); return EXIT_SUCCESS; }
Thanks in advance for the help! this is only my second program