Professional Documents
Culture Documents
Arrays and Loops
One of the nice things about arrays is that you can use a loop to manipulate each element. When an array
is declared, the value of each element is not set to 0 automatically.
Sample Program 1: Store 5 integers entered by the user to an array using a loop statement.
Sample Output:
Sample Program 2: Write a C program that will accept integers and display the sum and average.
Sample Output:
Practice 1: Key in the following code. Compare the output to the output of Sample Program 2.
What are your observations?