Sum all odd array elements?
I was wondering how one would sum up all of the even elements of an array into one sum and all of the odd elements of an array into another.
Let's say the array is "double a" and the size is "n".
I could first have to figure out if the array is either even or odd by doing a "%2 == 0" IF statement, but I don't know if that is necessary.
I'm guessing there could be two possible for loops with something in them like "a[n+2]" to skip every other value, and only go to as many values as the IF statement would retrieve.
The details are a bit fuzzy for me to think out logically, on paper, or in C. If someone could tell me a basic run down of how I should go about doing it or a for loop or two written out showing me how to skip odd/even values in an array that would be awesome.