Question: How many elements does the array int a[5];contain? Which is the first element? The last? What's wrong with this scrap of code? int a[5]; for(i

How many elements does the array int a[5];contain? Which is the first element? The last?

What's wrong with this scrap of code?

int a[5];

for(i = 1; i <= 5; i = i + 1)

a[i] = 0;

What would the equivalent code, using a while loop, be for the example

for(i = 0; i < 10; i = i + 1)

printf("i is %d ", i);

Write a program that will compute the average of 10 integers. In the main program, it will read in 10 numbers from the user and save those 10 numbers in an array. Define another function called calcAverage(int arr[], int length). This function will compute and return the average of the numbers in the array.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!