Skip to content

Commit

Permalink
function to calculate mean is added which fixes smuos#2
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuha99 committed Oct 1, 2014
1 parent 47cd420 commit 814bb2e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mm.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ int numcmp (const void *a, const void *b) {
return 0;
}

// function to calculate mean
float mean(const int* a, int n){
float avg =0;
int i;

for(i=0; i<n ; i++)
avg += a[i];

avg /= n;

return avg;
}

int main(int argc, char *argv[]) {

int i, length, *pt;
Expand Down

0 comments on commit 814bb2e

Please sign in to comment.