/* sales: Greatest sales of three consecutive months Example: Enter 1. value: 2 Enter 2. value: 2 Enter 3. value: 2 Enter 4. value: 2 Enter 5. value: 4 Enter 6. value: 6 Enter 7. value: 2 Enter 8. value: 2 Enter 9. value: 2 Enter 10. value: 2 Enter 11. value: 2 Enter 12. value: 2 Total sales 30. Greatest three month sales was 12 */ #include int monthsToProcess, currentMonth, /* Month */ INT_current, previous, preceding, /* Monthly values */ INT_greatest, total; /* Results */ int main (void) { printf("Enter 1. value: "); scanf("%d", &preceding); printf("Enter 2. value: "); scanf("%d", &previous); printf("Enter 3. value: "); scanf("%d", &INT_current); total = INT_current + previous + preceding; INT_greatest = total; monthsToProcess = 12; for (currentMonth = 4; currentMonth <= monthsToProcess; currentMonth += 1) { preceding = previous; previous = INT_current; printf("Enter %d. value: ", currentMonth); scanf("%d", &INT_current); total += INT_current; if (INT_current + previous + preceding > INT_greatest) INT_greatest = INT_current + previous + preceding; } printf("Total sales %d.\nGreatest three month sales was %d\n", total, INT_greatest); return(0); } Modify the above program not to look for three months sales but three months average sales so that the middle month has double the weight of the other two months (e.g., if the sales figures for three consecutive months are 1, 7, and 5, the weighted average is (1+7+7+5) / 4 = 5).