Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Name this program stats. c - This program below performs some basic statistics o

ID: 3796220 • Letter: N

Question

Name this program stats. c - This program below performs some basic statistics on an array of 5 integers. It must use the five functions indicated. You need to complete this program (write the five functions)_ #include #include void getData(int, int[]); double getMean(int, int[]); double getVariance(int, int[], double); double getStdDev(double); void printResults(double, double, double); int main() {int size = 5, array[5]; double mean, variance, stddev; getData(size, array); mean = getMean(size, array); variance = getVariance(size, array, mean); stddev = getStdDev(variance); printResults(mean, variance, stddev); return 0;}

Explanation / Answer

Please find the all 5 functions for the program:

double getMean(int n, int[] x{
double mean,sum=0;
for (i = 0; i < n; i++)
{
sum = sum + x[i];
}
mean= sum / (float)n;
return mean ;
}

double getVariance(int n, int[] x, double mean){
   double variance,sum1=0;
    for (i = 0; i < n; i++)
   {
   sum1 = sum1 + pow((x[i] - average), 2);
   }
   variance = sum1 / (double)n;
   return variance;
}


double getStdDev(double variance){
   double std_deviation ;
   std_deviation = sqrt(variance);
   return std_deviation ;
}


void printResult(double mean, double variance, double std_deviation) {
   printf("mean is %lf", mean);
   printf("variance is %lf", variance);
   printf("std_deviation is %lf", std_deviation);  
}

void getData(int n, int[] x){
for (i = 0; i < n; i++)
{
scanf("%f", &x[i]);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote