/* Normal Curve (15 points) The normal curve has a lot of applications in statistics. One application that many students are familiar with is "grading on a curve", where the mean scores get C's and the outliers get F's and A's. The Normal probability density function is defined as follows: 1 (x-mu)*(x-mu) f(x) = ---------------------- * exp( - -------------- ) sqrt(2*Pi*sigma*sigma) 2*sigma*sigma where mu is the mean of the distribution and sigma is the standard deviation. These are the only two parameters that are required to completely specify a normal curve. Write a Complete C program that reads three values from the keyboard (x, mu, sigma) and outputs the value f(x) of the function for that x. Your program must use a function to calculate f(x). SAMPLE RUN #1: Please enter the mean mu : 0 Please enter the standard deviation (sigma): 1 Please enter a value for x: 4 The result is = 0.00013383 SAMPLE RUN #2: Please enter the mean mu : 2 Please enter the standard deviation (sigma): 1 Please enter a value for x: 2 The result is = 0.398942 */ #include #include #include // this defines M_PI double calculate(double mu, double sigma, double x) { double result; result = 1.0/sqrt(2*M_PI*sigma*sigma); result = result * exp( - ((x-mu)*(x-mu)) / (2*sigma*sigma)); return result; } int main(void) { double mu, sigma, x; // enter the first vector printf("Please enter the mean mu : "); scanf("%lf", &mu); printf("Please enter the standard deviation (sigma): "); scanf("%lf", &sigma); printf("Please enter a value for x: "); scanf("%lf", &x); printf("The result is = %g\n\n", calculate(mu, sigma, x)); system("pause"); }