Sample Output
How many numbers? 7
Input a number -- 12
Input a number -- 22
Input a number -- 34
Input a number -- 43
Input a number -- 45
Input a number -- 54
Input a number -- 99
You have entered the following numbers
12
22
34
43
45
54
99
What is the standard deviation of the population? 30
The Sum of the sample is: 309
The Average of the sample is: 44.1429
The Biased Variance of the sample is: 676.408
The Standard Deviation of the sample is: 26.0078
The Chi-Square Distribution is: 4.5093
#include <iostream>
#include <cmath>
usingnamespace std;
int main()
{
int n, count;
float sum, avg, variance, stand;
sum = 0;
variance = 0;
avg = 0;
stand = 0;
cout << "How many numbers? ";
cin >> n;
float x[n];
for (count=0; count<=(n-1); count++)
{
cout << "Input a Number -- ";
cin >> x[count];
sum = sum + x[count];
}
avg = sum / n;
for (count=0; count<n; count++)
{
variance = variance + pow((x[count] - avg),2) / n;
}
stand = sqrt(variance);
cout << "The sum is: " << sum << endl;
cout << "The average is " << avg << endl;
cout << "The biased variance is " << variance << endl;
cout << "The standard deviation is " << stand << endl;
char c; cin >> c;
return 0;
}