calculate and display the average of all even values .
#include<stdio.h>
int main()
{
int numArrays[] = {2, 67, 23, 5, 7, 34, 14, 4, 8, 62};
int i, sum=0, 
double ave=0;
for(i=1; i<10; i++)
{
if(numArray[i]%2==0)
{
    printf("%d", numArray[a]);
    total+=numArray[a];
}
{
sum=sum+total;
printf("the total of all even number is; %d", sum);
}
ave=(float)sum/n;
printf("the average of all even numbers is: %f", ave);
returtn 0;
}

Your variable "i" in the for loop starts with 1.Make it 0 and then execute it.

remove the brackets on lines 15 and 18 because they are not necessary. Also format the program a little better to make it easier for you to follow the flow of the program.

    #include<stdio.h>
    int main()
    {
        int numArrays[] = {2, 67, 23, 5, 7, 34, 14, 4, 8, 62};
        int i, sum=0, 
        double ave=0;
        for(i=1; i<10; i++)
        {
            if(numArray[i]%2==0)
            {
                printf("%d", numArray[a]);
                total += numArray[a];
            }
        }
        sum=sum+total;
        printf("the total of all even number is; %d", sum);
        ave=(float)sum/n;
        printf("the average of all even numbers is: %f", ave);
        returtn 0;
    }

When asking for help, EXPLAIN what problem you are having. Do not expect us to try to figure out what it does wrong -- tell us!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.