The averages work fine, but for some reason the min and max doesn't work all the timeCode:void priceAvg(struct products *allProducts, int numProducts, int numMonths) { int i, j, k, l, m, n; double overall[numProducts], avg[numProducts], min[numProducts], max[numProducts]; for(i=0; i<numProducts; i++) { for(j=0; j<numMonths; j++) { overall[i] += allProducts[i].price[j]; } avg[i] = overall[i] / numMonths; for(k=0; k<numMonths; k++) { for(l=0; l<numMonths; l++) { if(allProducts[i].price[k] < allProducts[i].price[l]) min[i] = allProducts[i].price[k]; } } for(m=0; m<numMonths; m++) { for(n=0; n<numMonths; n++) { if(allProducts[i].price[m] > allProducts[i].price[n]) max[i] = allProducts[i].price[m]; } } printf("\n%s Avg:$%.2f Min:$%.2f Max:$%.2f", allProducts[i].name, avg[i], min[i], max[i]); } }