/* Average.c: compute the average of a set of numbers */ /* */ /* author: Rainer Doemer */ /* */ /* modifications: */ /* 10/10/04 RD initial version */ #include /* main function */ int main(void) { /* variable definitions */ int counter; double value; double total; double average; /* input and computation section */ counter = 1; total = 0.0; while (counter <= 10) { printf("Please enter value %d: ", counter); scanf("%lf", &value); total += value; counter++; } /* elihw */ /* computation section */ average = total / 10.0; /* output section */ printf("The average is %f.\n", average); /* exit */ return 0; } /* end of main */ /* EOF */