This program will require you to use a loop with some IF statement. It will requ
ID: 3626732 • Letter: T
Question
This program will require you to use a loop with some IF statement. It will require you to repeat the loop for 7 times, for the 7 days of the week. Ask the user what the temperature will be for each day of the week. The integer input from the keyboard will be tested in a series of IF test and the appropriate message will print.90-100-"Its a scorcher! Turn on the air conditioning!"
80-89- "Another hot day! Go for a swim!"
70-79- "A good day to tend to the garden!"
60-69- "Bring along a sweater today!"
0-59- "Stay inside and study C programming!"
Explanation / Answer
#include<iostream>
int main()
{
int i;
float temp;
for(i=1; i<8; i++)
{
printf(" Enter Temperature for Day %d :",i);
scanf("%f",&temp);
if(temp >= 90 && temp <= 100)
printf(" Its a scorcher! Turn on the air conditioning!");
else if(temp>=80 && temp<=89)
printf(" Another hot day! Go for a swim!");
else if(temp>=70 && temp<=79)
printf(" A good day to tend to the garden!");
else if(temp>=60 && temp<=69)
printf(" Bring along a sweater today!");
else if(temp>=0 && temp<=59)
printf(" Stay inside and study C programming!");
}
return 0;
}
Related 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.