int NumArray[]="2 ,67 ,23 ,5 ,7 ,34 ,14 ,4 ,8 , 62";

A. display all the value of NumArray with an ODD index
B. display all the value in NumArray that are ODD
C. calculate and display the average of all EVEN values
D. create another array, call it ArrayNum, then store the value of NumArray in reverse order. display the value in ArrayNum.
E. display all the index of NumArray whose value is greater than 10.
F. count and display the number of ODD and EVEN numbers
G. find the MAX and MIN number then calculate and display the average [(MAX+MIN)/2]
H. sort and display NumArray in ascending order
I. calculate and display the square root of each value in NumArray then store it in an array called SquareNumArray.

Recommended Answers

All 3 Replies

If you want help with your homework, then make an effort to do it first yourself. We aren't here to help you cheat, but we will help you if you make the effort.

o sorry for that i didnot mean to cheat i forgot to post the program i am making right know sorry for that ahm my compiler always says error even i copy a code from the book i gues my compiler is differ from the compiler that we had in our school and some of my code wont work look at this

 int main 
    {
        int NumArray[] = {2 ,67 ,23 ,5 ,7 ,34 ,14 ,4 ,8 , 62};
        int ArrayNum[10];
        float SquareNumArray[10];
        int oddNum[10];
        int i,j, count, cOdd, cEven,max,min;
        max = NumArray[0];
        min = NumArray[0];
        count = 0;
        cOdd = 0;
        cEven = 0;

    //A. display all the value of NumArray with an ODD index

        printf("A. Values of NumArray w Odd Index: \n");
        for(i=0;i<10; i++)
        {
           i+=1;
           printf("%d ", NumArray[i]);     
         }              

    //B. display all the value in NumArray that are ODD

        printf("\n\nB. Values in NumArray that are Odd:\n");
        for(i=0;i<10; i++)
        {       
           if(NumArray[i]%2==1)
           printf("%d ",NumArray[i]);

    and i tried another one for just letter a 

    int main()
    {
        int numArrays[] = {"2 ,67 ,23 ,5 ,7 ,34 ,14 ,4 ,8 , 62"};
        int i;

        printf("A. Values of NumArray with Odd Index: \n");
        for(i=0;i<=10; i++)
        {
           i+=1;
           printf("%d ", NumArray[i]);     
         } 

         }

You're missing a few brackets, parentheses, etc. Try this. Same code basically, but I added what is missing.

#include <cstdio>

int main()
{
    int NumArray[] = {2 ,67 ,23 ,5 ,7 ,34 ,14 ,4 ,8 , 62};
    int ArrayNum[10];
    float SquareNumArray[10];
    int oddNum[10];
    int i,j, count, cOdd, cEven,max,min;
    max = NumArray[0];
    min = NumArray[0];
    count = 0;
    cOdd = 0;
    cEven = 0;
    //A. display all the value of NumArray with an ODD index
    printf("A. Values of NumArray w Odd Index: \n");
    for(i=0;i<10; i++)
    {
        i+=1;
        printf("%d ", NumArray[i]);
    }
    //B. display all the value in NumArray that are ODD
    printf("\n\nB. Values in NumArray that are Odd:\n");
    for(i=0;i<10; i++)
    {
        if(NumArray[i]%2==1)
            printf("%d ",NumArray[i]);
    }

    return 0;
}
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.