Q: Write a program for Weather for different ranges of Temperatures using C++ Programming Language

Q:Write a Program , User will enter any temperature and according to that display messages about weather.

Temperature > 35                   ==>       Hot Day
25 > Temperature < 35           ==>       Pleasant Weather
Temperature < 25                   ==>       Cold day



Solution :

Program code:
#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
int temp;
cout<< "Enter value of Temperature" <<endl<<endl;
cin>>temp;
cout<<endl;
if(temp>35)
cout<<"Hot Day"<<endl<<endl;
if(temp > 25)
{
if(temp < 35)
cout<<"Pleasent Weather "<<endl<<endl;
}
else
cout<<"Cold Day"<<endl<<endl;
getch();

}


Output: After compiling and executing , the result is as follows



Hope that you will find this helpful

No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.