posted 11 years ago
Ok i have a program that takes 4 orchards over a 5 year span. I need to get the average of each orchard. Which I have..now i need to get the Total of the 4 orchards for each of the 5 years..then the average for each year which I'm having a real trouble doing.

I just can't seem to get the totals for each seperate year and the averages.

What i thinking is I have to:

for(i = 0; i < 4; i++) {

for(j = 0; j < 5; j++)

year_total[i] += peach[0][0] +peach[0][1] + peach[0][2] + peach[0][3];

year_avg[i] = (float)(year_total[i] / 4.0);

For each consecutive year..but when i do that it adds both years then averages them. Not sure where I'm going wrong here nor how to put all the years into 1 for statement if its even possible.