Answer:
#include <iostream>
using namespace std;
int main() {
double temps[10]={32.2,30.1,33.5,32.8,35.0,36.7,36.8,35.6,34.9,36.9};//initialized 10 temps values.
double avgTemp,total=0;//two varaibles declared.
for(int k=0;k<10;k++)//for loop to calculate the average..
{
total+=temps[k];//adding temperature values to the total..
}
avgTemp=total/10;//calcualting the average..
cout<<"The average temperature is "<<avgTemp<<endl;//printing the average temperature.
return 0;
}
Output:-
The average temperature is 34.45.
Step-by-step explanation:
The above written code is in C++. An array of double temps is initialized with arbitrary 10 values.Then the average is calculated using the integer k and the average is stored in the variable avgTemp. Then it is printed on the screen.