Write a program that prints messages for weather The program

Write a program that prints messages for weather. The program will get Fahrenheit degree from user input and print out following messages on the screen:

If temperature in Fahrenheit is over 100, print out message “Give us Ice! we are almost dead!!”.

If temperature in Fahrenheit is over 95, print out message “It\'s too hot!”.

If temperature in Fahrenheit is over 86, print out message “It\'s still hot!”.

If temperature in Fahrenheit is over 77, print out message “It\'s O.K…!”.

If temperature in Fahrenheit is over 68, print out message “It\'s good to do exercise!”.

If temperature in Fahrenheit is over 50, print out message “ It\'scool !”.

If temperature in Fahrenheit is over 32, print out message “It\'s chilly!”.

If temperature in Fahrenheit is less than 32, print out message “It’s cold!”.

use if... else if... else structure what we studied in the class.

Solution

solution in c language(in any programming language these statements remains same)

#include<stdio.h>


int main()
{
   int temperature;
  
   printf(\"please enter the temperature in fahrenheit \ \");
   scanf(\"%d\",&temperature);
  
   if(temperature<32)
   {
       printf(\"it\'s cold\");
   }else if(temperature>=32&temperature<50)
   {
       printf(\"it\'s chilly\'\");
   }else if(temperature>=50&temperature<68)
   {
       printf(\"it\'s cool\");
   }else if(temperature>=68&temperature<77)
   {
       printf(\"it\'s good to do exercise\'\");
   }else if(temperature>=77&temperature<86)
   {
       printf(\"it\'s ok\'\");
   }else if(temperature>=86&temperature<95)
   {
       printf(\"it\'s still hot\");
   }else if(temperature>=95&temperature<100)
   {
       printf(\"it\'s too hot\'\");
   }else
   printf(\"give us Ice! we are almost dead!!\");
   return 0;
      
}

output

please enter the temperature in fahrenheit
45
it\'s chilly\'
--------------------------------
Process exited after 7.632 seconds with return value 0
Press any key to continue . . .

Write a program that prints messages for weather. The program will get Fahrenheit degree from user input and print out following messages on the screen: If temp
Write a program that prints messages for weather. The program will get Fahrenheit degree from user input and print out following messages on the screen: If temp

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site