/* a C program about interesting numbers Author: Lin Jensen Date: 22 Jan 2016 */ #include //preprocessor directives #define LENGTH 5 /* global variables can go here */ int interesting[LENGTH] = {7, 11, 42, 0, 1729}; // array of integers char hello[] = "hello world"; // array of characters int main () { // main program float average; // local variables int sum = 0; int i; puts(hello); // put a string to output // loop through an array i = 0; //index of first element while (i < LENGTH) { sum = sum + interesting[i]; i++; // i=i+1, go on to next number } average = sum; // converts to float printf("%f\n",average); average = average/LENGTH; printf ("sum = %d, average = %f\n", sum, average); hello[5] = 'W'; puts (hello); interesting[5] = 65; // new values puts (hello); return 0; // normal termination } // end of main