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

By | 05.03.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.





1 1 vote
Article Rating
Notify of
Newest Most Voted
Inline Feedbacks
View all comments

its not right the sd should be 21.751847212199

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 :