Recitation9 - *min = x[i*mean=sum/i return 32.00 81.00 97.00 20.00 34.00 78.00 35.00 76.00 53.00 10.00 Sheet1 Page 2 11.00 35.00 75.00 86.00 25.00

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 R8_ 11/15/06 STA29 #include <stdio.h> #include <math.h> #define N 1000 int main (void) { double mean, max, min, x[N] int i=0, count void stats(double x[], int count, double *mean, double *max, double *min) FILE *input_file input_file = fopen("data9.txt", "r") i++ count=i for(i=0 i<count i++) { printf ("%6.2f ", x[i]) if((i+1)%10==0) printf("\n") } printf("\nMAX = %6.1f\n", max) printf("MEAN= %6.1f\n", mean) printf("MIN = %6.1f\n", min) printf("\n\n") return 0 } void stats(double x[], int count, double *mean, double *max, double *min) { double sum=x[0] int i *max= x[0] *min= x[0] for(i=1 i<count i++) { sum+= x[i] if(x[i]>*max) *max = x[i] * if(x[i]<*min)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: *min = x[i] } *mean=sum/i return } 32.00 81.00 97.00 20.00 34.00 78.00 35.00 76.00 53.00 10.00 Sheet1 Page 2 11.00 35.00 75.00 86.00 25.00 86.00 12.00 24.00 30.00 42.00 74.00 58.00 42.00 48.00 95.00 25.00 67.00 31.00 47.00 75.00 25.00 35.00 23.00 47.00 58.00 96.00 25.00 74.00 69.00 10.00 25.00 73.00 57.00 42.00 35.00 46.00 68.00 52.00 34.00 68.00 96.00 24.00 63.00 57.00 85.00 24.00 11.00 36.00 77.00 64.00 32.00 36.00 79.00 80.00 31.00 25.00 46.00 74.00 MAX = 97.0 MEAN= 50.1 MIN = 10.0 Press any key to continue 345.60 98.70 432.10 56.70 123.40 234.50 87.60 135.70 76.50 246.80 64.2 MAX = 432.1 MEAN= 172.9 MIN = 56.7 Press any key to continue...
View Full Document

This note was uploaded on 04/07/2008 for the course ESC 121 taught by Professor Serrano during the Spring '08 term at Cleveland State.

Page1 / 2

Recitation9 - *min = x[i*mean=sum/i return 32.00 81.00 97.00 20.00 34.00 78.00 35.00 76.00 53.00 10.00 Sheet1 Page 2 11.00 35.00 75.00 86.00 25.00

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online