# WAP in C that gets temperatures of week & calculate average tempr for that week

The Program in C that gets temperatures of the week & calculate the average temperature for that week is given below:

#include <stdio.h>

int main() {
float temp, sum = 0, avg;
for (int i = 1; i <= 7; i++) {
printf("Enter the temperature for day %d: ", i);
scanf("%f", &temp);
sum += temp;
}
avg = sum / 7.0;
printf("The average temperature for the week is: %.2f", avg);
return 0;
}

## Output:

Enter the temperature for day 1: 32
Enter the temperature for day 2: 34
Enter the temperature for day 3: 49
Enter the temperature for day 4: 33
Enter the temperature for day 5: 36
Enter the temperature for day 6: 32
Enter the temperature for day 7: 20
The average temperature for the week is: 32.43

## Pro-Tips💡

This program uses a for loop to prompt the user to enter the temperature for each day of the week. The variable temp stores the temperature entered by the user, and sum keeps track of the total temperature for the week.

The loop iterates 7 times, one for each day of the week. Inside the loop, the temperature for that day is added to the sum variable.

After the loop, the average temperature for the week is calculated by dividing the total temperature by 7(number of days in a week).

The result is then printed with 2 decimal points precision.

### Learn C-Sharp ↗

C-sharp covers every topic to learn about C-Sharp thoroughly.

### Learn C Programming ↗

C-Programming covers every topic to learn about C-Sharp thoroughly.

### Learn C++ Programming↗

C++ covers every topic to learn about C-Sharp thoroughly.

Codeauri is Code Learning Hub and Community for every Coder to learn Coding by navigating Structurally from Basic Programming to Front-End Development, Back-End Development to Database, and many more.

## C# Program to Find Sum of Rows & Columns of a Matrix

The Program in C# Program to Find Sum of Rows & Columns of a Matrix is given below: Output: Hello Codeauri Family,enter the number of rows and columns…

## C# Program to Calculate Determinant of Given Matrix

The Program in C# Program to Calculate Determinant of Given Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns of the matrix…

## C# Program to Find Sum of right Diagonals of a Matrix

The Program in C# Program to Find Sum of right Diagonals of a Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns…

## C# Program to Find Transpose of Given Matrix

The Program in C# Program to Find Transpose of Given Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns in the matrix:22Enter…

## C# Program for Multiplication of two square Matrices

The Program in C# Program for Multiplication of two square Matrices is given below: Output: Hello Codeauri Family, enter the number of rows/columns in the matrices:2Enter the elements…

## C# Program to Delete Element at Desired position From Array

The Program in C# Program to Delete Element at Desired position From Array is given below: Output: Hello Codeauri Family, enter the number of elements in the array:4Enter…

Your Journey into Code Begins Now: Discover the Wonders of Basic Programming

X