6.7. Case Study: Computing Mean, Median and Mode Using Arrays
We now consider a larger example. Computers are commonly used for survey data analysis to compile and analyze the results of surveys and opinion polls. Figure 6.16 uses array
response initialized with 99 responses to a survey. Each response is a number from 1 to 9. The program computes the mean, median and mode of the 99 values. Figure 6.17 contains a sample run of this program. This example includes most of the common manipulations usually required in array problems, including passing arrays to functions.
1 // Fig. 6.16: fig06_16.c 2 // Survey data analysis with arrays: 3 // computing the mean, median and mode of the data. 4 #include <stdio.h> ...