/* Program:LAB 5: Author: Ka Kit Ho Class:CSCI 110 Date:09/25/03 Description:Lab 5 array I certify that: - All code used in my program is either my original work or was modified by me from the source code published in the text of this course or provided by my instructor. - I have not used code obtained from another student, or any other unauthorized source, either modified or unmodified. - I have not discussed or shared coding details of this program with anyone other than my instructor or MT. SAC tutors. I understand that I may discuss the concepts/ideas of this program with other students as long as we do not get down to the coding details. */ #include int main() { int counter, mid, x = 11; double val[11] = {73.3,49.0,83.4,58.0,25.1,68.0,95.5,20.3,10.5}; double min, max; /* x = total amount of numbers entered val [#] = the numbers entered and the amount of numbers entered */ counter = 0; while (counter < x) { printf("%5.1lf",val[counter]); counter = counter + 1; if (counter % 5 == 0) { printf("\n"); } } printf("\n"); /* -----------------------------MAX------------------------*/ counter = 1; max = val[0]; while (counter < x) { if (val[counter] > max) { max = val[counter]; } counter = counter + 1; } printf("The maximum value is %5.1lf\n", max); /* -----------------------------MIN------------------------*/ counter = 1; min = val[0]; while (counter < x) { if (val[counter] < min) { min = val[counter]; } counter = counter + 1; } printf("The minimum value is %5.1lf\n", min); /* -----------------------------MIDDLE------------------------*/ counter = 1; while (counter < x) { if (counter % 2 == 0) { mid = (counter / 2); } else { mid = (counter / 2) + 1 ; } counter = counter + 1; } printf("the value in the middle position is %5.1lf\n",val[mid] ); printf("Statistics program provided by Ka Kit Ho\n"); return 0; }