Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 3b-50 points Write a program to process a collection of daily high tempe

ID: 2267776 • Letter: P

Question

Problem 3b-50 points Write a program to process a collection of daily high temperatures. Your program should count the number of hot days (high temperature 85 or higher), the number of pleasant days (high temperature 60-84), and the number of cold days (high temperatures less than 60). Test your program on the following 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-99 Note that the last value (-99) is used as a sentinel value and should not be counted as a cold day On the next page is a screen shot of a working solution with the while loop missing. ELET 3750 Embedded C

Explanation / Answer

#include <stdio.h>

int main()
{
int arr[50] = {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,-99}
int temperature=0,high_temp_days=0,plesant_temp_days=0,low_temp_days=0;
while(arr[temperature] != -99) //checks until sentinal value
{
if(arr[temperature]>=85)
high_temp_days++;
else if(arr[temperature]>=60 && arr[temperature]<=84)
plesant_temp_days++;
else(arr[temperature]<60)
low_temp_days++;
temperature++;
}
printf("high temperature days%d",high_temp_days);
printf("plesant temperature days%d",plesant_temp_days);
printf("low temperature days%d",low_temp_days);

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote