int main() { double x[8],mean,st_dev,sum,sum_sqr; int n; int i;
printf("Enter the size of a vector > "); scanf("%d",&n);
printf("Enter %d elements of the first vector > ",n);
for (i = 0; i < n; ++i) scanf("%lf",&x[i]);
for (i = 0; i < 8; ++i) { sum += x[i]; sum_sqr += x[i] * x[i]; }
mean = sum / 8; st_dev = sqrt(sum_sqr / 8 - mean * mean); printf("The mean is %.2f.\n",mean); printf("The standard deviation is %.2f.\n",st_dev);
printf("\nTable of differences between data values and mean\n"); printf("Index ITEM Difference\n"); for (i = 0; i < 8; ++i) printf("%3d%4c%9.2f%5c%9.2f\n",i,' ',x[i], ' ',x[i]-mean);