Write a program in C language to process a collection of daily high temperatures
ID: 673064 • Letter: W
Question
Write a program in C language to process a collection of daily high temperatures. Your program should count and print the number of hot days (high temperature- 85 or higher) , the number of pleasant days (high temperature- 64-80) and the number of cold days( high temperature-less than 60). It should also display the category of each temperature. Test your program on the follwing data.
55 62 68 74 59 45 41 58 60 67 65 78 82 88 91
92 90 93 87 80 78 79 72 68 61 59
Modify your program to display the average temperature (a real number)
at the end of the run.
Explanation / Answer
int main (void) { int temp; double average; hot_days = 0; pleasant_days = 0; cold_days = 0; printf("enter the temperatures you want to be categorized. Press Enter after each. -1 to end."); do { scanf("%d", &temp); if (temp == -1) break; if(temp >= 85) hot_days++; if(64Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.