# arrays and standard deviation

• 10-28-2002
bruceness
arrays and standard deviation
hi, i am working on a program that reads grades of students into an array of type double and computes the mean and standard deviation after throwing out the highest grade and the lowest grade. The maximum number of students is 100. I have figured out how to get the max and min grades however i cannot figure out how to read all the grades into the array and then get the deviation, if anyone could give me some help on this i would appreciate it.

Code:

```#include<stdio.h> #include<stdlib.h> #include<math.h> int maximum(double grades[], int n); /* Given an array of real numbers and the effective size of the array (i.e. count of the numbers in the array), this function returns the location of the highest number in the array */ int minimum(double grades[], int n); /* Given an array of real numbers and the effective size of the array (i.e. count of the numbers in the array), this function returns the location of the lowest number in the array */ void deleteElement(double grades[], int *n, int loc); /* Given an array of real numbers, the effective size of the array and the location of the element to be deleted, this function deletes that element from the array by shifting the rest of the elements one position to the left and decrementing the count by one */ double mean(double grades[], int n); /* Given an array of numbers and the effective size of the array this function computes and returns the mean */ double StandardDeviation(double grades[], int n); /* Given an array of numbers and the effective size of the array, this function computes and returns the standard deviation as described in the previous section */ int main(void)     double StandardDeviation = sqrt(sum/100);     int n, loc, sum, i;     double a[100];         for (i=0; i<100; i=i+1){     printf("Enter first grade:  ");     scanf("%d" &n);     a[i] = n;     }     /*finds the sum of all grades*/     sum=0;     for (i=0; i<=99; i=i+1)         sum=sum = a[i];     /*find minimun grade*/   int Minimum( double grades[], int n ){   int lowGrade = 100;   for ( int i = 0; i < n; i++ );       for ( int j = 0; j < n; j++ );         if ( grades[i][j] < lowGrade );             lowGrade = grades[i][j];   return lowGrade; }       /* Find the maximum grade*/   int Maximum( double grades[], int n ){   int highGrade = 0;   for ( int i = 0; i < n; i++ );       for ( int j = 0; j < n; j++ );         if ( grades[i][j] > highGrade );             highGrade = grades[i][j];   return highGrade; } output: Enter the first grade: 85 Enter the next grade: 76 Enter the next grade: 63.5 Enter the next grade: 100 Enter the next grade: 82 Enter the next grade: 5 Enter the next grade: 55 Enter the next grade: -999 The maximum grade is 100.00 The minimum grade is 5.00 The array contents after these values are deleted: 85.00    76.00    63.50    82.00    55.00    The mean is  72.30 The standard deviation is  11.36```