Write a C Program to find Mean, Variance and Standard deviation of n numbers

By | March 5, 2017

Write a C Program for Mean,Variance & Standard deviation of n numbers


Here in this c program,  we need to find out mean variance and standard deviation of n numbers, for that we need to know what is meant by mean, standard deviation and variance.

Mean : it is the average of a number of elements in a set of values. which means just add the values in a set and divide the sum with the number of elements in the set.

Variance : It is the average of squared difference of mean and the values of the data set it is  called the spread of data within a sample of data.

Standard deviation : after we got the variance we get the standard deviation by taking square root of the variance

In this c program we are taking the values for a set from the users, the mean is calculated by taking average of the sum by using a for loop . after that we need to calculate variance using the formula “value=a[i]-mean; sumsqr=sumsqr + value*value;” and var = sumsqr/ n; then now we need to calculate the standard deviation of the set, we use SD = sqrt(var) formula in this c program.

Here is source code of the C program to calculate the mean, variance & standard deviation. The C program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.


SOURCE CODE : :


 


OUTPUT : :


 

2 thoughts on “Write a C Program to find Mean, Variance and Standard deviation of n numbers

    1. Codez Club Post author

      I know you are saying correct but look at the link below and input these numbers as above and see what results is :

      Click here >

      The results will look like :

      Total Numbers
      7
      Mean (Average)
      43.14286
      Standard deviation
      21.75185
      Variance(Standard deviation)
      473.14286
      Population Standard deviation
      20.1383
      Variance(Population Standard deviation)
      405.55102

      Thanks for asking that question…..

      Reply

Leave a Reply