All pastes #812945 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-12-12 03:14 UTC
rendered paste body
/* Put Your Heading Here!!!*/

#include <stdio.h> /*You may need more than this!*/
#define POP 99
int mean(int response[]);
int median(int response[]);

int main() {
	
	int response[POP] = {6, 7, 8, 9, 8, 7, 8, 9, 8, 9,
						7, 8, 9, 5, 9, 8, 7, 8, 7, 8,
						6, 7, 8, 9, 3, 9, 8, 7, 8, 7,
						7, 8, 9, 8, 9, 8, 9, 7, 8, 9,
						6, 7, 8, 7, 8, 7, 9, 8, 9, 2,
						7, 8, 9, 8, 9, 8, 9, 7, 5, 3,
						5, 6, 7, 2, 5, 3, 9, 4, 6, 4,
						7, 8, 9, 6, 8, 7, 8, 9, 7, 8,
						7, 4, 4, 2, 5, 3, 8, 7, 5, 6,
						4, 5, 6, 1, 6, 5, 7, 8, 7};
int i, pass, b,c;
int total = 0;
printf("Response in original order\n");

for (i=0; i <= POP-1; i++)

     printf("%2d", response[i]);

 

for (pass = 1; pass < POP ; pass++)  
     for(i = 0; i < POP-1 ; i++) 
          if (response[i] > response[i+1])
          {
              b = response[i]; 
              response[i] = response[i+1];
              response[i+1] = b;
          }
		printf("\nResponse in order\n");
		for (i = 0; i <= POP - 1; i++)
     	printf("%2d", response[i]);
		printf("\n");
		printf("\n");
	c = mean(response);
	printf("This is your mean %d", c);
	median(response);
}
int mean(int response[])
{
static int total = 0;
total =+ response[POP];
return total / 99;
}
int median(int response[])
{
printf("\nThis is your median %d", response[49]);
}