// Examples of array use #include int main() { int i; // loop counter int sum = 0; // accumulator variable int list[10]; /* initialize to a pattern, with a for-loop */ for (i = 0; i < 10; i++) list[i] = 3 * i + 1; /* print contents */ printf("\nThe list: "); for (i = 0; i < 10; i++) printf("%d ", list[i]); /* Let user type new values */ printf("\nPlease enter 10 new array elements: "); for (i = 0; i < 10; i++) scanf("%d", &list[i]); /* print contents */ printf("\nThe list: "); for (i = 0; i < 10; i++) printf("%d ", list[i]); /* Now add the array contents */ for (i = 0; i < 10; i++) sum = sum + list[i]; printf("\nThe sum of the array elements is: %d\n", sum); return 0; }