“Find Average Temperature of Week” is a C language program to input 7 days temperature in Array and Find Average”. In this C language program we enter temperature readings of a week in a float array and then calculate and display average temperature of the week.
“Find Average Temperature of Week” is a C language program to input 7 days temperature in Array and Find Average”.
Here is the source code in C language for temperature average program.
Write a C Program
to input seven days temperature in a float array
then calculate and find average temperature
of the week.
float tempArray, sum=0,average;
/*input temperatures in array and find sum of these
using for loop*/
for(i=0; i<7; i++)
printf("Enter Temperature Reading of Day:%d=",i+1);
sum = sum + tempArray[i];
/* calculate and show average temperature*/
average = sum / 7.0;
printf("The Average Temperature of the week is = %.2f",average);