Hello
Everyone
I got an assignment as follows
Write a program to calculate the standard deviation of a list of numbers. Use a constant in your program for the size of the list.
The stanadard deviation of a set of data is a measure of the central tendancy of that data (how closely bunched around the mean it is). It is calculated by :
1) finding the mean (average)
2) finding the sum of the squares of each element's distance from the mean
3) dividing by the number of elements in the data set
4 ) taking the square root
Example:
Data 5, 6, 7, 10, 12
Average: 8
Distances from the Mean: 3, 2, 1, 2, 4
Sum of the Squares of Distances from the Mean: (3*3 + 2*2 + 1*1 + 2*2 + 4*4) = 34
Divide by number of elements, and take the square root : Square root of 34/5= 2.61 (approx)
Can someone please show how to do this ?
I have no sample code to show as I am really confused in even initializing the variables.
instead of cout and cin our programs are made with printf and scanf
Please kindly help me in this assignment so i can learn how to do it.How do make the formulas ?
Thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main ()
{
const int data[5]={ 5, 6, 7, 10, 12};
int list=5;
int DistancefromtheMean;
int SumoftheSquares;
int divide;
float squareroot;
int sum;
int average;
int i=0;
int j=0;
int k=0;
system("pause");
return(0)
}
