I wanted to take the averages of the whole week and output a print statement. I've tired few ways this like assigning "temp" a pointer, or in each if statement assigning temp to a new variable like a, b , c etc. Then adding them all up at the end and dividing by 7. My issue is I am unclear how to store the number typed for each if statement while the program is running, then have it compute the simple equation. The code in question is below:
Code:#include <stdio.h> int main(int argc, const char * argv[]) { int i, j = 0, temp = 0; for (i=1; i<=7; i++) { j++; printf("Enter the temperature for the %d day of the week\n", j); scanf("%d",&temp); if (temp >= 90) { printf("It's a scorcher! Turn on the air conditioning!\n"); } else if (temp >= 80) { printf("Another hot day! Go for a swim!\n"); } else if (temp >= 70) { printf("A good day to tend to your garden\n"); } else if (temp >= 60) { printf("Bring along a sweater today!\n"); } else if (temp <= 59) { printf("Stay inside and study C programing\n"); } } return 0; }