Answer:
The solution of this code is given below in explanation section.
Explanation:
The C code of this problem is given below
/*******************************************************************************/
#include <stdio.h>
int main()
{
int n=12, i;//n show the elements in array, while i will be used in for loop
float Array_Temperaure[]={10, 12, 13, 15, 20, 23, 25, 25, 25, 16, 13, 10};//Array_Temperaure declared and initialized
float sum = 0.0;// sum variable declared and initialized
float avg;// avg average variable declared and initialized
for (i = 0; i < 12; ++i) //for loop to iterate through elements in Array_Temperaure.
{
sum += Array_Temperaure[i];// in sum vaiable, Array_Temperaure numbers are added
}
avg = sum / n;// average is calculated
printf("Sum = %.2f", sum);// sum is shown
printf("\nAverage = %.2f", avg);// average is desplayed.
return 0;
}
/*************************************************************** algorithm******************/
declare array Array_Temperaure[12];
declare int variable n ,i;
declare float variable sum and average;
for loop
To iterate n time
sum the number of array at current index into total sum
calculate average;
display sum;
display average;
terminate the program;