Answer:
The answer for the given question is :
total=0; // initialize the variable "total" to 0
for (k=0; k<n; k++) { //set for loop
total += temps[k];
}
avgTemp =total/n; //the answer will be stored in "avgTemp" variable
Step-by-step explanation:
Here, we set variable "total" and initialize to 0.
Then, we set the for loop which starts from 0 and stops at "n".
After, that we calculate the average temperature and store the result of calculation in "avgTemp" variable.