Common array operations
📖 Scenario: You are working with a list of daily temperatures recorded over a week. You want to perform some common operations on this list to understand the data better.
🎯 Goal: Build a C program that stores daily temperatures in an array, calculates the average temperature, finds the highest temperature, and prints the results.
📋 What You'll Learn
Create an integer array with exactly 7 elements representing daily temperatures.
Create an integer variable to hold the sum of temperatures.
Use a
for loop with the variable i to iterate over the array elements.Calculate the average temperature as a float.
Find the highest temperature using a variable called
max_temp.Print the average temperature and the highest temperature using
printf.💡 Why This Matters
🌍 Real World
Analyzing temperature data helps in weather forecasting and understanding climate patterns.
💼 Career
Knowing how to work with arrays and loops is essential for many programming jobs, especially in data processing and embedded systems.
Progress0 / 4 steps