Skip to content

Commit

Permalink
Resolved issue smuos#3, median function is working.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcsl94 committed Sep 26, 2014
1 parent 31d38fb commit 0eea8bd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

#define debug 0

//Median calculating function
int median(int *pt, int length)
{
int middle = (length/2);
int median = pt[middle];
return median;
}

//Mean calculating function
double mean(int *pt, int length)
{
Expand Down Expand Up @@ -63,5 +71,8 @@ int main(int argc, char *argv[]) {

// Call mean function
fprintf(stdout, "The mean is: %.2f \n", mean(pt, length));

// Call median function
fprintf(stdout, "The median is: %d \n", median(pt, length));
return 0;
}

0 comments on commit 0eea8bd

Please sign in to comment.